• Resolved freddyeee

    (@freddyeee)


    Hi

    As you can see in the url and in any other shop page category, I have this texts circled that are not suppose to appear, those go in the product page.

    This texts go in every product page, but the problem is just in these 3 products. Also the price doesn’t appear under the product tittle.

    how to fix that ?

    • This topic was modified 2 years ago by freddyeee.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Aamir

    (@aamiribsf)

    Hello @freddyeee,

    Greeting for the day!

    This text seems to be coming from some plugin. Here’s what we can do to make sure:

    Firstly, try to temporarily switch to another theme, like default themes like – Twenty-Twenty or Twenty Nineteen, and check if the error or issue persists.

    Next, you can deactivate all the plugins temporarily Except WooCommerce and Variation swatches and see if that solves the error. If it does then activate plugins one by one to see which plugin is causing the problem.

    Learn more about troubleshooting in WordPress:?How to Troubleshoot a Conflict with the Plugin & Theme?

    Hope this helps.

    Let me know how it goes.

    Thread Starter freddyeee

    (@freddyeee)

    the conflict was this code on the functions.php :

    // For product variations (on variable products)
    add_filter( 'woocommerce_available_variation', 'variable_product_saving_amount', 15, 3 );
    function variable_product_saving_amount( $data, $product, $variation ) {
    
        if( $variation->is_on_sale() ) {
            $saved_amount  = $data['display_regular_price'] - $data['display_price'];
            $percentage    = round( $saved_amount / $data['display_regular_price'] * 100 );
    
            $data['price_html'] .= '<p id="saving_total_price"><span style="font-size:16px !important;color:black !important;font-weight:bold !important;">'. __("Ahorras") .' : ' . wc_price($saved_amount) . ' ('.$percentage.'%)</span></p>';     
        }
        return $data;
    }
    

    I’ve been using that code for so long, could you please help me with some tweaks to avoid having that conflict ?

    Plugin Support Sravan Bhaskaravajjula

    (@bhshravankumar)

    Hello @freddyeee,

    Please allow us some time to go through the code and to share our findings.

    Thread Starter freddyeee

    (@freddyeee)

    did you figure out how to use that code without any conflict with the plugin ?

    Plugin Support Sravan Bhaskaravajjula

    (@bhshravankumar)

    Hello @freddyeee,

    Our developers are busy with priority tasks this week, today our developers visited the shared webpage URL [https://www.runayaq.com/categoria-producto/mujer/], the page is not showing this issue, please share a page URL where this issue exists now so that our developers can look into the issue, or let us know how to replicate the issue, the theme you are using so that I can replicate the issue for our developers.

    Looking forward to hearing from you.

    Thread Starter freddyeee

    (@freddyeee)

    right now you won’t be able to see the issue on my website, since I erased the code from the functions.php file ,it’d look really bad and the site is live.

    You can replicate the issue:
    I have kadence theme , I have a child theme where I put the code I already mentioned in the functions.php file.

    // For product variations (on variable products)
    add_filter( 'woocommerce_available_variation', 'variable_product_saving_amount', 15, 3 );
    function variable_product_saving_amount( $data, $product, $variation ) {
    
        if( $variation->is_on_sale() ) {
            $saved_amount  = $data['display_regular_price'] - $data['display_price'];
            $percentage    = round( $saved_amount / $data['display_regular_price'] * 100 );
    
            $data['price_html'] .= '<p id="saving_total_price"><span style="font-size:16px !important;color:black !important;font-weight:bold !important;">'. __("Ahorras") .' : ' . wc_price($saved_amount) . ' ('.$percentage.'%)</span></p>';     
        }
        return $data;
    }

    All my products are variables ,some with size and color attributes and others with just 1 or 2 color attibutes. The issues are on the product pages of the products with just 1 color and size attributes and also just 1 color. Other issues appear also in the shop page with products with just 1 and 2 colors.

    • This reply was modified 2 years ago by freddyeee.
    Plugin Support Aamir

    (@aamiribsf)

    Hello @freddyeee,

    Thanks for getting back to us.

    The code that you are using is to display the saved amount and percentage discount on the variable products that are on sale. That is why it is showing in the variable products on the shop page.

    Please try this code to show the saved amount only on product pages.

    // For product variations (on variable products)
    add_filter( 'woocommerce_available_variation', 'variable_product_saving_amount', 15, 3 );
    function variable_product_saving_amount( $data, $product, $variation ) {
    
    if( is_product() && $variation->is_on_sale() ) {
    $saved_amount = $data['display_regular_price'] - $data['display_price'];
    $percentage = round( $saved_amount / $data['display_regular_price'] * 100 );
    
    $data['price_html'] .= '<p id="saving_total_price"><span style="font-size:16px !important;color:black !important;font-weight:bold !important;">'. __("Ahorras") .' : ' . wc_price($saved_amount) . ' ('.$percentage.'%)</span></p>';
    }
    return $data;
    }

    I hope this helps. Looking forward to hearing from you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Bug in shop page’ is closed to new replies.