Show variations attributes in Woocommerce Added to Cart message
-
Hi, there. Thank you for creating the great WooCommerce. ??
I just recently use WooCommerce to build an e-commerce website. I’ve an issue when a product is added to cart and it shows the “added to cart” message. My website requires the “added to cart message” to show the summary/details of the product recently added such as title, price and variations.
Right now, I managed to have the product title and the price detail of the product for both the simple and variation product type. However, I can’t figure out when it comes to showing the product variation attributes for the variation product type (ex: color/size). I tried to use the
get_post_meta( $productID, 'pa_size', true)
or
$product->get_attribute('pa_size');
but no luck for me. It shows all the variations value for the current product while I only need the selectedvariation value.For example, a product has color variation: Gold and Silver. If user choose Gold, I want it to return variation value or could be variation id of Gold.
I wonder how to work this around since I’m quite stuck on the issue for quite a while. ??
Thank you,
Cheers.
- The topic ‘Show variations attributes in Woocommerce Added to Cart message’ is closed to new replies.