Auto set specific attribute term value to purchased products on Woocommerce












1














I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status.



I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value.



When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it.



The featured part is done and works, but I can't figure out how to add a specific attribute value to the products.



Here's my code:



add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);

function order_status_on_hold_update_products( $order_id, $order ) {
foreach ( $order->get_items() as $item_id => $item ) {
$product = $item->get_product();
$product->set_featured(true);
$product->set_attributes(???); // I don't know if and how set_attributes() should be used
$product->save();
}









share|improve this question





























    1














    I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status.



    I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value.



    When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it.



    The featured part is done and works, but I can't figure out how to add a specific attribute value to the products.



    Here's my code:



    add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);

    function order_status_on_hold_update_products( $order_id, $order ) {
    foreach ( $order->get_items() as $item_id => $item ) {
    $product = $item->get_product();
    $product->set_featured(true);
    $product->set_attributes(???); // I don't know if and how set_attributes() should be used
    $product->save();
    }









    share|improve this question



























      1












      1








      1







      I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status.



      I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value.



      When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it.



      The featured part is done and works, but I can't figure out how to add a specific attribute value to the products.



      Here's my code:



      add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);

      function order_status_on_hold_update_products( $order_id, $order ) {
      foreach ( $order->get_items() as $item_id => $item ) {
      $product = $item->get_product();
      $product->set_featured(true);
      $product->set_attributes(???); // I don't know if and how set_attributes() should be used
      $product->save();
      }









      share|improve this question















      I want to automatically add a specific attribute value (which was previously set up) to ordered products when the order is placed and has "on-hold" status.



      I sell unique products and I have set up the "STOCK" attribute and the "Out Of Stock" (out-of-stock) value.



      When an order is placed and has "on-hold" status, I want to automatically change the featured status of the ordered products and also to add the out-of-stock attribute value to it.



      The featured part is done and works, but I can't figure out how to add a specific attribute value to the products.



      Here's my code:



      add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);

      function order_status_on_hold_update_products( $order_id, $order ) {
      foreach ( $order->get_items() as $item_id => $item ) {
      $product = $item->get_product();
      $product->set_featured(true);
      $product->set_attributes(???); // I don't know if and how set_attributes() should be used
      $product->save();
      }






      php wordpress woocommerce product orders






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      LoicTheAztec

      84.5k136095




      84.5k136095










      asked yesterday









      Robert Popescu

      396




      396
























          1 Answer
          1






          active

          oldest

          votes


















          1














          To set stock status "Out of Stock" you will use the WC_Product method set_stock_status() this way:



           $product->set_stock_status('outofstock'); // Or "instock"
          $product->save();


          To set a product attribute term in your hooked function (work for variable products too):



          add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);
          function order_status_on_hold_update_products( $order_id, $order ) {
          foreach ( $order->get_items() as $item_id => $item ) {
          $product = $item->get_product();

          // Handling variable products
          $_product = $product->is_type('variation') ? wc_get_product( $item->get_product_id() ) : $product;

          $_product->set_featured( true );

          // Your product attribute settings
          $taxonomy = 'pa_stock'; // The taxonomy
          $term_name = "Out Of Stock"; // The term

          $attributes = (array) $_product->get_attributes();
          $term_id = get_term_by( 'name', $term_name, $taxonomy )->term_id;

          // 1) If The product attribute is set for the product
          if( array_key_exists( $taxonomy, $attributes ) ) {
          foreach( $attributes as $key => $attribute ){
          if( $key == $taxonomy ){
          $attribute->set_options( array( $term_id ) );
          $attributes[$key] = $attribute;
          break;
          }
          }
          $_product->set_attributes( $attributes );
          }
          // 2. The product attribute is not set for the product
          else {
          $attribute = new WC_Product_Attribute();

          $attribute->set_id( sizeof( $attributes) + 1 );
          $attribute->set_name( $taxonomy );
          $attribute->set_options( array( $term_id ) );
          $attribute->set_position( sizeof( $attributes) + 1 );
          $attribute->set_visible( true );
          $attribute->set_variation( false );
          $attributes = $attribute;

          $_product->set_attributes( $attributes );
          }

          $_product->save();

          // Append the new term in the product
          if( ! has_term( $term_name, $taxonomy, $_product->get_id() ) )
          wp_set_object_terms($_product->get_id(), $term_slug, $taxonomy, true );
          }
          }


          Code goes in function.php file of your active child theme (or active theme). it should works.






          share|improve this answer























          • the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
            – Robert Popescu
            yesterday












          • For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
            – Robert Popescu
            yesterday












          • Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
            – Robert Popescu
            yesterday












          • @RobertPopescu You can keep what you need in the code… That is the way to do it.
            – LoicTheAztec
            yesterday








          • 1




            Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
            – Robert Popescu
            yesterday











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944532%2fauto-set-specific-attribute-term-value-to-purchased-products-on-woocommerce%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          To set stock status "Out of Stock" you will use the WC_Product method set_stock_status() this way:



           $product->set_stock_status('outofstock'); // Or "instock"
          $product->save();


          To set a product attribute term in your hooked function (work for variable products too):



          add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);
          function order_status_on_hold_update_products( $order_id, $order ) {
          foreach ( $order->get_items() as $item_id => $item ) {
          $product = $item->get_product();

          // Handling variable products
          $_product = $product->is_type('variation') ? wc_get_product( $item->get_product_id() ) : $product;

          $_product->set_featured( true );

          // Your product attribute settings
          $taxonomy = 'pa_stock'; // The taxonomy
          $term_name = "Out Of Stock"; // The term

          $attributes = (array) $_product->get_attributes();
          $term_id = get_term_by( 'name', $term_name, $taxonomy )->term_id;

          // 1) If The product attribute is set for the product
          if( array_key_exists( $taxonomy, $attributes ) ) {
          foreach( $attributes as $key => $attribute ){
          if( $key == $taxonomy ){
          $attribute->set_options( array( $term_id ) );
          $attributes[$key] = $attribute;
          break;
          }
          }
          $_product->set_attributes( $attributes );
          }
          // 2. The product attribute is not set for the product
          else {
          $attribute = new WC_Product_Attribute();

          $attribute->set_id( sizeof( $attributes) + 1 );
          $attribute->set_name( $taxonomy );
          $attribute->set_options( array( $term_id ) );
          $attribute->set_position( sizeof( $attributes) + 1 );
          $attribute->set_visible( true );
          $attribute->set_variation( false );
          $attributes = $attribute;

          $_product->set_attributes( $attributes );
          }

          $_product->save();

          // Append the new term in the product
          if( ! has_term( $term_name, $taxonomy, $_product->get_id() ) )
          wp_set_object_terms($_product->get_id(), $term_slug, $taxonomy, true );
          }
          }


          Code goes in function.php file of your active child theme (or active theme). it should works.






          share|improve this answer























          • the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
            – Robert Popescu
            yesterday












          • For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
            – Robert Popescu
            yesterday












          • Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
            – Robert Popescu
            yesterday












          • @RobertPopescu You can keep what you need in the code… That is the way to do it.
            – LoicTheAztec
            yesterday








          • 1




            Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
            – Robert Popescu
            yesterday
















          1














          To set stock status "Out of Stock" you will use the WC_Product method set_stock_status() this way:



           $product->set_stock_status('outofstock'); // Or "instock"
          $product->save();


          To set a product attribute term in your hooked function (work for variable products too):



          add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);
          function order_status_on_hold_update_products( $order_id, $order ) {
          foreach ( $order->get_items() as $item_id => $item ) {
          $product = $item->get_product();

          // Handling variable products
          $_product = $product->is_type('variation') ? wc_get_product( $item->get_product_id() ) : $product;

          $_product->set_featured( true );

          // Your product attribute settings
          $taxonomy = 'pa_stock'; // The taxonomy
          $term_name = "Out Of Stock"; // The term

          $attributes = (array) $_product->get_attributes();
          $term_id = get_term_by( 'name', $term_name, $taxonomy )->term_id;

          // 1) If The product attribute is set for the product
          if( array_key_exists( $taxonomy, $attributes ) ) {
          foreach( $attributes as $key => $attribute ){
          if( $key == $taxonomy ){
          $attribute->set_options( array( $term_id ) );
          $attributes[$key] = $attribute;
          break;
          }
          }
          $_product->set_attributes( $attributes );
          }
          // 2. The product attribute is not set for the product
          else {
          $attribute = new WC_Product_Attribute();

          $attribute->set_id( sizeof( $attributes) + 1 );
          $attribute->set_name( $taxonomy );
          $attribute->set_options( array( $term_id ) );
          $attribute->set_position( sizeof( $attributes) + 1 );
          $attribute->set_visible( true );
          $attribute->set_variation( false );
          $attributes = $attribute;

          $_product->set_attributes( $attributes );
          }

          $_product->save();

          // Append the new term in the product
          if( ! has_term( $term_name, $taxonomy, $_product->get_id() ) )
          wp_set_object_terms($_product->get_id(), $term_slug, $taxonomy, true );
          }
          }


          Code goes in function.php file of your active child theme (or active theme). it should works.






          share|improve this answer























          • the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
            – Robert Popescu
            yesterday












          • For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
            – Robert Popescu
            yesterday












          • Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
            – Robert Popescu
            yesterday












          • @RobertPopescu You can keep what you need in the code… That is the way to do it.
            – LoicTheAztec
            yesterday








          • 1




            Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
            – Robert Popescu
            yesterday














          1












          1








          1






          To set stock status "Out of Stock" you will use the WC_Product method set_stock_status() this way:



           $product->set_stock_status('outofstock'); // Or "instock"
          $product->save();


          To set a product attribute term in your hooked function (work for variable products too):



          add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);
          function order_status_on_hold_update_products( $order_id, $order ) {
          foreach ( $order->get_items() as $item_id => $item ) {
          $product = $item->get_product();

          // Handling variable products
          $_product = $product->is_type('variation') ? wc_get_product( $item->get_product_id() ) : $product;

          $_product->set_featured( true );

          // Your product attribute settings
          $taxonomy = 'pa_stock'; // The taxonomy
          $term_name = "Out Of Stock"; // The term

          $attributes = (array) $_product->get_attributes();
          $term_id = get_term_by( 'name', $term_name, $taxonomy )->term_id;

          // 1) If The product attribute is set for the product
          if( array_key_exists( $taxonomy, $attributes ) ) {
          foreach( $attributes as $key => $attribute ){
          if( $key == $taxonomy ){
          $attribute->set_options( array( $term_id ) );
          $attributes[$key] = $attribute;
          break;
          }
          }
          $_product->set_attributes( $attributes );
          }
          // 2. The product attribute is not set for the product
          else {
          $attribute = new WC_Product_Attribute();

          $attribute->set_id( sizeof( $attributes) + 1 );
          $attribute->set_name( $taxonomy );
          $attribute->set_options( array( $term_id ) );
          $attribute->set_position( sizeof( $attributes) + 1 );
          $attribute->set_visible( true );
          $attribute->set_variation( false );
          $attributes = $attribute;

          $_product->set_attributes( $attributes );
          }

          $_product->save();

          // Append the new term in the product
          if( ! has_term( $term_name, $taxonomy, $_product->get_id() ) )
          wp_set_object_terms($_product->get_id(), $term_slug, $taxonomy, true );
          }
          }


          Code goes in function.php file of your active child theme (or active theme). it should works.






          share|improve this answer














          To set stock status "Out of Stock" you will use the WC_Product method set_stock_status() this way:



           $product->set_stock_status('outofstock'); // Or "instock"
          $product->save();


          To set a product attribute term in your hooked function (work for variable products too):



          add_action('woocommerce_order_status_on-hold', 'order_status_on_hold_update_products', 20, 2);
          function order_status_on_hold_update_products( $order_id, $order ) {
          foreach ( $order->get_items() as $item_id => $item ) {
          $product = $item->get_product();

          // Handling variable products
          $_product = $product->is_type('variation') ? wc_get_product( $item->get_product_id() ) : $product;

          $_product->set_featured( true );

          // Your product attribute settings
          $taxonomy = 'pa_stock'; // The taxonomy
          $term_name = "Out Of Stock"; // The term

          $attributes = (array) $_product->get_attributes();
          $term_id = get_term_by( 'name', $term_name, $taxonomy )->term_id;

          // 1) If The product attribute is set for the product
          if( array_key_exists( $taxonomy, $attributes ) ) {
          foreach( $attributes as $key => $attribute ){
          if( $key == $taxonomy ){
          $attribute->set_options( array( $term_id ) );
          $attributes[$key] = $attribute;
          break;
          }
          }
          $_product->set_attributes( $attributes );
          }
          // 2. The product attribute is not set for the product
          else {
          $attribute = new WC_Product_Attribute();

          $attribute->set_id( sizeof( $attributes) + 1 );
          $attribute->set_name( $taxonomy );
          $attribute->set_options( array( $term_id ) );
          $attribute->set_position( sizeof( $attributes) + 1 );
          $attribute->set_visible( true );
          $attribute->set_variation( false );
          $attributes = $attribute;

          $_product->set_attributes( $attributes );
          }

          $_product->save();

          // Append the new term in the product
          if( ! has_term( $term_name, $taxonomy, $_product->get_id() ) )
          wp_set_object_terms($_product->get_id(), $term_slug, $taxonomy, true );
          }
          }


          Code goes in function.php file of your active child theme (or active theme). it should works.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          LoicTheAztec

          84.5k136095




          84.5k136095












          • the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
            – Robert Popescu
            yesterday












          • For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
            – Robert Popescu
            yesterday












          • Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
            – Robert Popescu
            yesterday












          • @RobertPopescu You can keep what you need in the code… That is the way to do it.
            – LoicTheAztec
            yesterday








          • 1




            Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
            – Robert Popescu
            yesterday


















          • the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
            – Robert Popescu
            yesterday












          • For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
            – Robert Popescu
            yesterday












          • Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
            – Robert Popescu
            yesterday












          • @RobertPopescu You can keep what you need in the code… That is the way to do it.
            – LoicTheAztec
            yesterday








          • 1




            Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
            – Robert Popescu
            yesterday
















          the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
          – Robert Popescu
          yesterday






          the Out Of Stock attribute value was more like an example, even though I am using it as an attribute for a special, different purpose. Thus, I don't want to just set the stock status, but to add a specific attribute value to the product. So you're saying that "set_attributes()" is not working for my case? Basically, I'm not setting a new custom attribute, but I simply want to add an already existing attribute value to the products from "on-hold" orders.
          – Robert Popescu
          yesterday














          For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
          – Robert Popescu
          yesterday






          For example, if I have "Color" as attribute and "Red", "Green" and "Blue" as values, I want to automatically add the "Red" value to the products from on-hold orders.
          – Robert Popescu
          yesterday














          Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
          – Robert Popescu
          yesterday






          Thank you. I will try now and revert. Just to be clear...I only need the part "1) If The product attribute is set for the product", right? Because the attribute is already existing and it has ONLY ONE Value. I just want this single attribute value to be added to the product once the product is ordered.
          – Robert Popescu
          yesterday














          @RobertPopescu You can keep what you need in the code… That is the way to do it.
          – LoicTheAztec
          yesterday






          @RobertPopescu You can keep what you need in the code… That is the way to do it.
          – LoicTheAztec
          yesterday






          1




          1




          Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
          – Robert Popescu
          yesterday




          Ok, I don't really understand some lines from your code and what they do exactly, but I tested the whole thing as it is and it works as intended. This is exactly what I wanted to obtain. Can't thank you enough, kind Sir!
          – Robert Popescu
          yesterday


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944532%2fauto-set-specific-attribute-term-value-to-purchased-products-on-woocommerce%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas