• Resolved DRHughes00

    (@drhughes00)


    When I post a new product through the API I send an array which includes all the attribute and variations for the product (snippet below).

    $this->product_array['product']['variations'][$v]['regular_price'] = $stock_and_prices['Bag 50 grams']['price'];
                $this->product_array['product']['variations'][$v]['managing_stock'] = true;
                $this->product_array['product']['variations'][$v]['stock_quantity'] = $stock_and_prices['Bag 50 grams']['stock'];
                $this->product_array['product']['variations'][$v]['attributes'][0]['name'] = 'Quantity';
                $this->product_array['product']['variations'][$v]['attributes'][0]['option'] = 'Bag 50 grams';
                $this->product_array['product']['variations'][$v]['description'] = $stock_and_prices['Bag 50 grams']['description'];

    This works just fine. The problem comes when I want to amend the variation because of a product change. I can access everything in the variation except the variation description – if I display the product, the variations are all there but without a description. Example follows:

    [2] => Array
                                    (
                                        [id] => 31240
                                        [created_at] => 2016-04-27T09:40:42Z
                                        [updated_at] => 2016-04-27T09:40:42Z
                                        [downloadable] =>
                                        [virtual] =>
                                        [permalink] => https://thebeadster.com/product/brooch-back-25x5mm/?attribute_quantity=Bag+50+grams
                                        [sku] => 5861011-136
                                        [price] => 8.75
                                        [regular_price] => 8.75
                                        [sale_price] =>
                                        [taxable] =>
                                        [tax_status] => taxable
                                        [tax_class] =>
                                        [managing_stock] => 1
                                        [stock_quantity] => 29
                                        [in_stock] => 1
                                        [backordered] =>
                                        [purchaseable] => 1
                                        [visible] => 1
                                        [on_sale] =>
                                        [weight] =>
                                        [dimensions] => Array
                                            (
                                                [length] => 25.00000000
                                                [width] => 5.00000000
                                                [height] => 0.00000000
                                                [unit] => mm
                                            )
    
                                        [shipping_class] =>
                                        [shipping_class_id] =>
                                        [image] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [id] => 31237
                                                        [created_at] => 2016-04-27T09:40:42Z
                                                        [updated_at] => 2016-04-27T09:40:42Z
                                                        [src] => https://thebeadster.com/wp-content/uploads/Prod_Im_5861011-136-3.jpg
                                                        [title] =>
                                                        [alt] =>
                                                        [position] => 0
                                                    )
    
                                            )
    
                                        [attributes] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [name] => quantity
                                                        [slug] => quantity
                                                        [option] => Bag 50 grams
                                                    )
    
                                            )
    
                                        [downloads] => Array
                                            (
                                            )
    
                                        [download_limit] => 0
                                        [download_expiry] => 0
                                    )

    How can I access the variation description in order to change it?

    Dennis

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Variation description not accessible?’ is closed to new replies.