0

I use a plugin, WooCommerce Simple Auctions. It has a list of custom fields, which I want to display their values. I got told by the support that I should use var_dump(), which I did, and it returned a null string. I use a child theme for this.

I want it to display in the content-product.php loop, which is the loop for displaying multiple products.

What I have tried:

<a><?php var_dump( $_auction_dates_from ); ?></a>

The list of custom fields (scroll down to 33): https://wpgenie.org/woocommerce-simple-auctions/documentation/#faq

How to display the desired value?

1

To retrieve a post (or product) custom field, it depends on where you want to display it.

To get a single custom fields:

// in your product loop, 

$reserved_price = get_post_meta($post->ID, '_auction_reserved_price', true);

echo $reserved_price;

if you want to get an array of all your plugin custom fields. You must loop trough all meta for the product

$product_metas = get_post_meta($post->ID);
foreach($product_metas as $key=> $value){
    if(str_pos('_auction', $key) !== false){
        $metas[$key] = $value[0]; 
    }
}

var_dump($metas); // to see the array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.