Questions tagged [product-variations]

106 questions
1
vote
1 answer

Only keep in cart the last variation from WooCommerce variable products

I have 1 Product with 3 Variations and I only want 1 variation in the cart at a time from the same variable product, but don't want to create a roadblock with an error message and a dead-end. I want to swap the variations if the same product is…
Aaron
  • 45
  • 3
1
vote
1 answer

Bulk enable product variations in WooCommerce via SQL

In WooCommerce, my product variations are disabled so the item appear out of stock despite they are in stock. I need some help to enable this option in all of my woocommerce product variations. I want to enable the checkbox where it appears the text…
1
vote
1 answer

Display WooCommerce variable subscriptions and its variations in a drop down list

I have been creating a plugin and I am trying to pull all woo commerce subscriptions and the variations within the subscription product into a drop down list. I have successfully pulled the top level product into the drop down list but for some…
1
vote
0 answers

wp_insert_post generating duplicate id

I use following code to generate id for a product variation. $i = 0; while($i < 2){ // 2 is example $product = wc_get_product($product_id); $variation_post = array( 'post_title' => 'Variation #' . $i . ' of ' . $product->get_name(), …
Web Design
  • 129
  • 15
1
vote
1 answer

Create multiple product variations issue for a WooCommerce variable product

I am trying to add 2 product variations programmatically for a variable product. Based on this answer thread, I am using the following shortened function: function create_product_variation( $product_id, $variation_data ){ $product =…
1
vote
0 answers

Hide Row if woocommerce product attribute is selected

I am trying to hide a row depending on whether the product attribute is selected or not. I have tried to create a new script inside the child theme like this: $(document).ready(function() { …
1
vote
1 answer

Stock value import XML feed with variations

I would like to import a XML feed with stock values. I would like to import the stock of a SKU to multiple SKU's in woocommerce. (we have a printing company where you can buy branded merchandise, a bottle for instance has different variations based…
Kees Kaas
  • 51
  • 4
1
vote
1 answer

WooCommerce: Get SKUs of all product variations

I have a list of products which should show variations in it's own row. The code for that works fine so far. But I couldn't figure out how I could show the SKU of a variation. Here's my current code: $args = [ 'status' => array('publish',…
Cray
  • 3,872
  • 7
  • 36
  • 96
1
vote
0 answers

Woocommerce - How to conditionally change button text on variable product page?

I spent my day trying to understand how can I set a conditional button for my variable products based on stock. I followed and searched all tips, discussions, etc... But nothing is OK. The idea is : if no variation selected : Pick your style if…
1
vote
0 answers

Drupal-8 Commerce - Adding multiple add to cart buttons to multiple product variations

I want to display multiple variations for a product as follows: each variation has different colors which can be purchased in different sizes. I want all the color variations to be displayed on the product display but have a separate add to cart for…
Susie
  • 11
  • 2
0
votes
0 answers

Woocommerce reset variation

I have an issue with a Woocommerce website where I provide flying vouchers. On each product, there are 2 varieties to choose from Airport (each airport offers different flight durations to pick from) duration of flight Currently, when user chooses…
0
votes
0 answers

Woocommerce variation description in visual editor

Since the variation description always contains a lot of HTML I would like to change the layout for the variation description of a single product to the Visual Editor like you have in the short description. Is this possible?
user3877230
  • 422
  • 4
  • 15
0
votes
1 answer

WooCommerce: Get price of chosen product variation

I am making a custom add-on for my products on my WooCommerce webshop. Everything works as it should, but I only need one thing. When customers check the checkbox on the product page, $30 must be added to the original price of the selected…
dan_2300
  • 1
  • 1
0
votes
0 answers

WooCommerce Product Variation Custom Field and Its Price Calculation

There I wanted to add a custom field in WooCommerce->Product->variation Tab so that a store manager can input the quantity for that particular variation. For example; Product: Mango (Different Types) - Every type has different price break…
Bilal
  • 21
  • 1
0
votes
2 answers

Add product variations programmatically via specific data in WooCommerce

What i am trying to do is save a new variation but when saving it, it throws an error Call to a member function get_name() on string; The variations are being created but without any attribute value. public static function…