Thursday, December 1, 2022
HomeWordPress Developmentwoocommerce offtopic - Learn how to echo different merchandise variations/attributes in single...

woocommerce offtopic – Learn how to echo different merchandise variations/attributes in single product web page


I’m displaying different merchandise from completely different class on a single product web page (to additionally add to cart).
Learn how to get these merchandise with variations/attributes (measurement, coloration and many others.) from variable product added fields?

    <?php $args = array('post_type' => 'product', 'posts_per_page' => 5, 'product_cat' => $custom_category, 'orderby' => 'menu_order', 'order' => 'ASC');
    $loop = new WP_Query($args);
        whereas ($loop->have_posts()) : $loop->the_post();
                world $product; ?>

                <li class="extra-product">

                        <?php if (has_post_thumbnail($loop->post->ID)) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
                        else echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="80px" top="80px" />'; ?>
                        <div class="extra-product_wrapper">
                            <h5><?php the_title(); ?></h5>
                            <?php woocommerce_template_loop_add_to_cart($loop->put up, $product); ?>
                        </div>
                        <span class="extra-price"><?php echo $product->get_price_html(); ?></span>

                </li>
            <?php endwhile; ?>
            <?php wp_reset_query(); ?>
        </ul>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments