Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #576661

    Hello,

    I’m using Enfold as my parent theme and have an Enfold child theme for customizations. I’m experiencing an issue where the price is not showing on the product detail page if it’s a variation type of product, but only currently has one variation. When a product has more than one variation, then the price displays.

    I’ve posted an example in the private content box below.

    The user never gets to see the price until they add the product to the cart and go look at the price in the cart. I’m having a very tough time figuring out what function to override in functions.php of my child theme in order to change this behavior, or where the woocommerce code is located just so that I can look at how it’s working now. Can you help?

    Thanks much.

    #576737

    Hi voyageurweb!

    The one variation product does have a sale price? Have you also checked that the variation has a price assigned to it properly?
    Can u change the default value not to be the variation but the Selection, so we can see if that will make it work?

    Regards,
    Basilis

    #576747

    Greetings,

    None of the products on this site have a sale going, so only the Regular price is filled in.
    All of the products are already set to “No Default”, so it’s expected that the user picks one. However, it appears that when there is only one variation, it picks it for you anyway. I don’t actually have it set to a default though.

    Thoughts?

    #577539

    Hi!

    The product variation type is meant to work for products with multiple options. If the product doesn’t have any variations, you have to set the product data to a simple product. If you really need to display the price of the single product variation, you have to modify the config-templatebuilder > avia-shortcodes > product_snippet_button.php file, look for this code around line 66:

    // $product = wc_get_product();
    			$output .= "<div class='av-woo-purchase-button ".$meta['el_class']."'>";
    

    .. below, you can add this:

    $output .= $product->get_price_html();
    

    Cheers!
    Ismael

    #577996

    Hello,

    I’m interested in a solution that doesn’t have me editing any parent theme files. How would I affect this with a child theme functions.php override via some hook?

    I get that a product with only one variation seems a bit silly, but I still think the code for handling products with variations should output the price even when there is only one variation. Perhaps all but one variation are only temporarily unavailable, or new variations are coming soon… Either way, it seems like a bug to me that no price is displayed when there is only one product variation.

    #579559

    Hey!

    Product variations are not a part of theme functions but it is just the way woocommerce works. As Ismael mentioned price will display for product variations only if the price is set for that variation.

    To create a child theme and maintain the changes is very easy please follow the steps below

    http://kriesi.at/documentation/enfold/using-a-child-theme/

    Best regards,
    Vinay Kashyap

    #579562

    Hi!

    it’s not a bug, as this behavior is expected (as Ismael already mentioned). It would require a huge amount of time to provide you a code for your child theme. You would need to hire a freelance developer for this kind of job.

    Cheers!
    Andy

    #579868

    Hello Gents,

    Thanks for your replies, but I feel like my actual problem isn’t being considered here, and is being clouded by some of your responses. Let me try to clarify things a bit.

    1. I’m not asking for help on how to create a child theme. I know how to do this, and I always do. One thing I have noticed in general in Kriesi’s support team answers is that they fall into one of two realms. The support person either provides a smart answer that shows a coding solution inside of child theme code, OR the support person responds with a way to “hack” the parent theme directly. In my opinion, the type of answer that tells the poster to hack the parent theme is not a good answer, and at least twice in the past, I have had to come back and say that I’m not interested in a solution that has me changing parent theme code. So I wasn’t asking for help on how to make a child theme, Vinnie. I was asking for a solution that doesn’t change code in the parent theme. Ismael’s response would have me editing parent theme code.

    2. I’m not suggesting that product variations were added by the Enfold theme. I know that variations are part of WooCommerce. We are intentionally using them on many sites we do. What I am suggesting is that there may be a bug in how the Enfold theme displays product variations. Specifically, the bug might be exposed by the case where there is only one product variation. Vinnie, I do have the product variation prices set, so I’m not sure where you are getting the impression that I left them blank. My point is that when I setup a product with only one variation, and I put in the price, the price is not displaying on the screen on the product detail page.

    I hope this helps clarify what I’m saying. I know that messages like this lack tone, so I might also add that you should read it as if I’m smiling and clarifying, and not as grumpy cat… Thanks guys!

    #579885

    Hi!

    We understand what you want to say, no worries.
    What Vinnie suggested although, is to create a child theme, so you do not modify parent them but modify that, to the child theme.

    To make his answer better and validate it, you will have to also add the following code to the child themes function file

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
    	$template_url = get_stylesheet_directory();
        	array_unshift($paths, $template_url.'/shortcodes/');
    
    	return $paths;
    }

    which will help identify the correct shortcodes path, for the new edited file.

    Some solutions can be done with a hook or functions others although might not be able to be done like that, so we have to provide alternatives, to keep providing amazing support for you!

    Let us know if you have more issues

    Regards,
    Basilis

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.