79287693

Date: 2024-12-17 11:37:27
Score: 2
Natty:
Report link

LoicTheAztec's code did not work for me but was of great help in getting to a working solution. Here it is:

function get_product_data( $customer_data, $order ) {

    foreach ( $order->get_items() as $item ) {

        if ( 12496 === $item->get_product_id() && (($order->get_total() > '0') || wcs_order_contains_subscription( $order, 'parent' )) ) {
            $customer_data['journey_sub_variation'] = $item['variation_id'];
        }
    }

    return $customer_data;

}
add_filter( 'wpf_woocommerce_customer_data', 'get_product_data', 10, 2 );

Thanks again LoicTheAztec

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): did not work
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Marlon