Support » WooCommerce » Add „attribute“ to cart

  • hi there, can anyone help me with the „code“ for this:

    //the following code works and adds the Purchase note to the carts items.
    //I need to add a specific attribute aswell under the NOTE.
    add_filter( ‚woocommerce_get_item_data‘, ‚wc_test‘, 10, 2 );

    function wc_test ( $other_data, $cart_item )
    {
    $post_data = get_post( $cart_item[‚product_id‘] );
    $other_data[] = array( ’name‘ => $post_data->_purchase_note );
    return $other_data;
    }

    ——
    Also I always get „:“ as a Result for the Note @ all products that dont have a note :S

    Kind Regards
    Dave

Ansicht von 1 Antwort (von insgesamt 1)
  • Moderation Note: sorry, I close this thread as you have asked your question in a German support forum in English. To keep the threads accessible to all people not speaking English, I kindly ask you to either rephrase your question in German or ask in the International support forums. Thank you for your understanding. Best regards, Hans-Gerd

Ansicht von 1 Antwort (von insgesamt 1)
  • Das Thema „Add „attribute“ to cart“ ist für neue Antworten geschlossen.