Quantcast
Channel: WordPress.org Forums » [WooCommerce] Support
Viewing all articles
Browse latest Browse all 104029

mattmikulla on "[Plugin: WooCommerce - excelling eCommerce] Get WooCommerce Scheduled Sale End Date"

$
0
0

I'm at a loss here.

My understanding of PHP is so so. I can learn from example though.

You just need to provide the id of the variation, instead of the main product id.

Would I use? get_variation_id

If so I modified the following function and replaced get_the_ID with get_variation_id and am getting an undefined function error:

add_action( 'woocommerce_single_product_summary', 'woocommerce_output_sale_end_date', 10 );
function woocommerce_output_sale_end_date() {
$sale_end_date = get_post_meta( get_variation_id(), '_sale_price_dates_to', true );
if ( ! empty( $sale_end_date ) )
echo '<span id="sale-price-to-date">' . __( 'Sale End Date: ', 'woocommerce' ) . date( 'Y-m-d', $sale_end_date ) . '</span>';
}

Any idea why that wouldn't work?


Viewing all articles
Browse latest Browse all 104029

Trending Articles