1
votes

I wanted to export a Advanced custom field and therefore I used the Function Editor in wpallexport, but nothing is showing up. I created a ACF field for the product in woocommerce (wirtschaftlicher_eigentumer), I tried to get it over the product_id but nothing appears.

function wirtschaftlicher_eigen ($product_id) {
    if ( ! empty($product_id) ) {
        return get_field('wirtschaftlicher_eigentumer', 'product_' . $product_id);
    }
}

Want to get the field but instead it's empty.

1
Have you checked if the custom field has saved data in the database? - designtocode
yes, i've checked this and i only get the pruduct_id not the ACF field - Gatti
Did it: function wirtschaftlicher_eigen( $product_id ) { if ( ! empty( $product_id ) ) { return get_field( 'wirtschaftlicher_eigentumer', $product_id ); } } - Gatti
Is it working @Gatti? - designtocode

1 Answers

0
votes

You need to change

return get_field('wirtschaftlicher_eigentumer', 'product_' . $product_id);

To

return get_field('wirtschaftlicher_eigentumer', $product_id);

The $product_id will return the current post id.