Support

Account

Home Forums General Issues Mirroring Custom Field Values

Solving

Mirroring Custom Field Values

  • I created my own custom fields using ACF for dimensions (height, width, length).

    In the WooCommerce shipping section these dimensions exist too (slugs: _height, _width, _length)

    I want to enter these 3 dimensions in the ACF custom fields and I need these values to automatically populate the WooCommerce shipping dimensions and the other way round. In other words they always need to be mirrored.

    How can I do this?

    Many thanks.

    Alex

  • You need to find the database names of the fields in woo. Then you need to create and acf/save_post filter https://www.advancedcustomfields.com/resources/acfsave_post/. When the post is saved with the ACF fields you need to get the values of those fields and use update_post_meta() to update the woo fields.

    woo may have it’s own function to do the same.

    The other site, you need to figure out what hook in woo to add a filter to in order to copy the values in the other direction. You’ll need to get this information from woo support.

  • Hey John, many thanks for your help. I am new to all this but will try to do as you suggested. I’ll write again if there is something I don’t get.

    Alex

  • If you have trouble with the ACF side of things let me know. If you can figure out what filters/hooks to use for WooCommerce we may be able to help with that.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.