• Resolved mroandersons

    (@mroandersons)


    I’m using custom code to add meta data for certain item:

    add_action( 'woocommerce_checkout_create_order_line_item', 'save_custom_posted_field_into_order', 9999, 4 );

    function save_custom_posted_field_into_order( $item, $cart_item_key, $values, $order ) {
    if ( ! empty( $values['free_sample'] ) ) {
    $product = wc_get_product( $values['free_sample'] );
    if ( !$product ) return;
    $product_name = $product->get_name();
    $product_sku = $product->get_sku();
    $item->update_meta_data( 'ID', $values['free_sample'] );
    $item->update_meta_data( 'Free sample for', $product_name );
    $item->update_meta_data( 'Product sku', $product_sku );
    }
    }

    But when payment is made using PayPal express checkout button in Cart, it seems it does not trigger this function.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @mroandersons

    The first step to address this issue is to check whether you are skipping the checkout page confirmation for express payments. If this is the case, the hook woocommerce_checkout_create_order_line_item might not be triggered because the order is created programmatically without passing through the normal checkout process.

    To resolve this, you can enable “Require final confirmation on checkout” in the Standard Payments tab of your PayPal plugin settings. Once you’ve done that, please let us know the outcome.

    Kind Regards,

    Krystian

    Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @mroandersons

    Since we have not received any further communication from you, we are assuming that your issue has been resolved.

    Therefore, we mark this thread as resolved. If you still have any questions or if a new problem arises, don’t hesitate to open a new thread.

    Kind regards,
    Krystian

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.