skip to Main Content

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • Hello Najeeb,

    I found there is one hook in plugin.class.php
    add_filter ( 'woocommerce_add_cart_item_data', array ($this, 'add_product_meta_to_cart' ), 10, 2 );

     * Adding product meta to cart A very important function
    function add_product_meta_to_cart($the_cart_data, $product_id) {

    I am also trying to do same like this for “Order Again”

    add_filter ( 'woocommerce_order_again_cart_item_data', array ($this, 'add_product_meta_to_cart' ), 10, 2 );

    But still I am not able to Add “Personalize Meta” to new order.

    let me know if I am doing this right?

    • This reply was modified 2 years ago by  Digitize Info System. Reason: code was not perfectly encoded

    Hi Najeeb,

    There is one filter in woocommerce “woocommerce_order_again_cart_item_data” which executes when you are doing “Order Again”. (you can find it in Woocommerce plugin)

    I have tried to overwrite this functionality but it finds that the Personalize option from previous order is not being coming.

    have a look at this previous order:

    and I do “Order Again”:

    and I put the above filter to see what is coming for order item:

    here is my code in functions.php

    add_filter( 'woocommerce_order_again_cart_item_data', 'trophy_order_again_cart_item_data', 10, 3 );
    function trophy_order_again_cart_item_data($cart_item_meta, $product, $order)
    	$order_items = $order->get_items();
         echo '<pre>';
    //     print_r($product);
    //     print_r($order);
    //     remove_all_filters('woocommerce_add_to_cart_validation');
    //Create an array of all the missing custom field keys that needs to be added in cart item.
    //     $customfields = [
    //         'customfield_key1',
    //         'customfield_key2',
    //         'customfield_key3',
    //         'customfield_key4',
    //     ];
    //     global $woocommerce;
    //     remove_all_filters( 'woocommerce_add_to_cart_validation' );
    //     if ( ! array_key_exists( 'item_meta', $cart_item_meta ) || ! is_array( $cart_item_meta['item_meta'] ) )
    //         foreach ( $customfields as $key ){
    //             if(!empty($product[$key])){
    //                 $cart_item_meta[$key] = $product[$key];
    //             }
    //     }
        return $cart_item_meta;

    Let me know if any other way I can insert personalize options into the new Order for “Order Again”, It will be a great help if you can assist me achieve this goal as my whole project is under pause mode and it create problem for me with the client.

    Let me know if you want to have a buyer account I will mail you those details.

    Hi Najeeb,

    I am yet on this to find a clue, I find when doing “Order Again” the personalize options from previous order’s variation_id is coming “0” thus Woocommerce treat this as “Out of Stock”

    can you help me around fixing this issue on how to bring the Personalize option from previous order and set for a new order, if it is a mysql Query then I am also going to implement this.

    Your help is much appreciated, thanks.

    Hello Najeeb,

    Any help related to this is much appriciated, thanks.

    By Re order I mean to say for example.

    if I ordered a Trophy with Personalized engraving options and now when I do “Re Order” or “Order Again” the previous options for Personalize it not being reflected in. and I want to figure this out.

    in reply to: Condition rule for "Required" field like condition show #8045

    OK Najeeb, I just found a thing, not sure why this happening.

    1. if I give title of text as “Title (on one line)” it auto generates name like title__on_one_line_
    2. But generated html is having id like title_on_one_line (without one underscore after “title” and “line”
    2.1 Database is having the same entry of id like “title__on_one_line_” and this is causing the problem
    3. so I just did rename title to “Title on one line” and now it works just fine.

    I am checking with other personalized options I have created.

    in reply to: Condition rule for "Required" field like condition show #8043

    Hello Najeeb, I just found that this is not working properly.


    if I write console.log it says “undefined”

    in reply to: Condition rule for "Required" field like condition show #8042

    Hello Najeeb,

    Any progress?

    in reply to: Condition rule for "Required" field like condition show #8039

    Hi Najeeb,

    thanks for the reply, if you check this link:

    Now select any radio buttoon except “No Engraving Required on Trophy Cup” and do these process

    1. Hit add to cart with keep required field empty
    2. Hit Add to cart with insert anything in required fields

    and you can see that when doing add to cart for some reason validations are not working nor I am able to do add to cart on ajax validation.

    Furthermore if I disable Ajax validation it validate perfectly as I required but when it displays the validation I have to re-choose the options and insert all the previously details.

    I really need to fix this as without this my client won’t going to check the site updates anymore.

    your help in this matter is much appriciated.

    If you required I can provide you the credentials to look into backadmin as well. There is no issues in export just in validation

    in reply to: Condition rule for "Required" field like condition show #8036

    Hello Najeeb,

    I have exported the options:

    Kindly check and do reply back as I need this fixed urgently.

Viewing 10 posts - 1 through 10 (of 10 total)
Back To Top