Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Woocommerce Product Image Conflict with multi products on one page

I am trying to develop a package product page. Person can add a different variable product. It all seems good, just the image gallery is behaving strange. When selecting the variation options the gallery gets duplicated. Seems like a JS conflict of duplicate coding?? I cannot figure out how I can overcome this. See this loom: https://www.loom.com/share/5dbd5378566e4b4090a3cfe19adc72ff

add_shortcode('rlt_product', function($atts) {
        ob_start();
        $atts = shortcode_atts(array(
                'product_id' => 0,
            ), $atts);
            if ($atts['product_id'] === 0) {
            return;
            }
        $q = new WP_Query(array(
            'post_type' => 'product',
            'p'         => $atts['product_id'],
        ));
        ?>
        <?php while ( $q->have_posts() ) : ?>
            <?php $q->the_post();
            ?>
            <div class="product-template-default single single-product woocommerce-page woocommerce woocommerce-page woocommerce-js">
            <style>.woocommerce-product-gallery{opacity: 1!important;display:block!important;}</style>            
            <?php
            global $product;
            do_action( 'woocommerce_before_single_product' );

            if ( post_password_required() ) {
                echo get_the_password_form(); // WPCS: XSS ok.
                return;
            }
            ?>
            <div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>
                <?php do_action( 'woocommerce_before_single_product_summary' ); ?>
                <div class="summary entry-summary">
                    <?php do_action( 'woocommerce_single_product_summary' ); ?>
                </div>
                
            </div>  
</div>
            <?php do_action( 'woocommerce_after_single_product' ); ?>

        <?php endwhile; // end of the loop. ?>

        
        <div style="margin-top: 30rem;"></div>
        <?php
        wp_reset_postdata();
        $html = ob_get_clean();
        return $html;
    });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!