I would like to replace the dash ( – ) with round brackets ( ) around WooCommerce product variation names. Normally a WooCommerce product variation is displayed like this: Sometimes this dash can be confused by a minus, and it looks like it’s the main product minus the variation. This depends on both the product and variation names. So the
Tag: product-variations
Enhanced WooCommerce Custom Fields for Variations
Using the Remi Coulson tutorial, a custom field has been added for product variations. This works, however the custom field is positioned by the add-to-cart button. I wish to position it within Additional Information tab. I have tried adding the front end code to the additional-information.php but it does not display. Added to functions.php to display variation Answer Note that
Get weight value from WooCommerce variations of a variable product
I am working on a plugin that auto adjusts product prices. All of my products are variable products which has made this tougher than I can solve. I have a check to make sure the product is variable. The only product Attribute is ‘Size’. Here I have 4-8 different Size Variations per product. Each of these have a weight value
How to get current selected variable product specific data in WooCommerce
I want to access the selected product variation Weight value in php. I tried below code its getting last value of attribute, not selected. Answer The selected variation properties can only be accessed via Javascript as it’s a client side live event… Here below is an example, that will display the selected variation custom attribute “attribute_weight” term slug for the
Product variation and parent variable product objects in WooCommerce hook
I developed a custom delivery time info for variations. But for some reason, I can’t get the parent product id of the variation to use it in my function. I tried the following – if I set $id straight …
Remove specific product variation from cart in WooCommerce
I want to remove a variation product from the cart in wordpress, woocommerce. I’m able to remove a simple product but not a variation product. With this code I can remove a simple product. I have tried passing in both the variation id and the parent variation id. I have no idea why its not working, would appreciate if some
Get on sale dates for the variations of a WooCommerce variable product
Is there any way to get on_sale_from and on_sale_to dates for WooCommerce variable products in an array using PHP? The highlighted red boxes in this screenshot:
Add a Contact Form to “Out of Stock” product Variations in WooCommerce
I have successfully added a contact form to a product if it is Out of Stock using But I also want to add the same form if a products variation is Out of Stock too. Just unsure as to which hook I can use to tie it in to the Out of Stock message for that variation… I feel like
Get all Product Variations based on one default attribute value in WooCommerce
Following Loic’s workflow here Can I get all the variations related to the product basing on one particular variation in default value. Example: Get all variations with attribute_pa_sizes similar to the default value’s attribute_pa_sizes echo $variation_values[‘attributes’][‘attribute_pa_sizes’] . ‘: ‘ . $price ; Answer This can be done with the following code (based on this answer): Tested and works
Set variations default attributes values for a variable product Programmatically
I’m building a site where WooCommerce Variable products (with Products Variations) are inserted programmatically. I have followed this tutorial successfully: Insert WooCommerce Products & Variations Programmatically I need just something that is missing: How to set variations default attributes values for a variable product? Is it possible? Answer 1). You will need to insert in your json data for each