• Resolved Suika

    (@suikalum)


    Hello, I am passing a catalog_id through WC’s default order notes field. And at the moment it comes through as {order: {note: "71"}}

    How I need it to look like is {order: {note: "{catalog_id: 71}"}}

    Any ideas on how to achieve this? Thanks!

    https://ww.wp.xz.cn/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter Suika

    (@suikalum)

    Figured this out. I didn’t realise it’s only a label so just added this to my functions.php to modify the default value of the field.

    Note: The value I’m fetching is in a session.

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields( $fields ) {
    	$fields['order']['order_comments']['default'] = '{catalog_id: ' . $_SESSION['catalog_id'] . '}';
    	return $fields;
    }
Viewing 1 replies (of 1 total)

The topic ‘Modify checkout order field's name when passed’ is closed to new replies.