• Resolved yikesitskevin

    (@yikesitskevin)


    Hi all!

    I’d like to show a custom field, “Monthly Price,” for a product. This is just an informational field because the true cart/order/WooCommerce total amount is being showed. The monthly field is not being calculated. I have achieved this using an action, like so:

    add_action('woocommerce_cart_totals_before_order_total', 'my_function')

    function my_function() { echo <div>Custom cart content here!</div>; }

    However, I have one dropdown field configured via Checkout Field Editor, and that can change the monthly price that I want to display.

    How can I access the value of the custom field that is being changed? Is this accessible in the WC cart? It looks like it’s a fee, however, I can’t access it when I do WC()->getCart()->getFees().

    I know that after the order is submitted, the metadata is held as order metadata. But where is the metadata held before the order is submitted?

    I am looking for something like WC()->getCart()->getFees()['my_custom_checkout_field'].

    Thank you!

    Kevin.

Viewing 1 replies (of 1 total)
  • Plugin Support Dina S.

    (@themehighsupport)

    Kindly note that the value is not saved anywhere before submitting the order. It is saved as metadata only after submitting the order.

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘How to access the custom metadata during the checkout process (PHP)’ is closed to new replies.