• I got this code for the sale start & end date, So it shows on a product page:

    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_the_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>';
    }

    Somehow I need to ad this code, so it picks up the drop price timeframe from the drop price plugin for woocommerce instead of the sale end date:

    $drop_price_dates_from 	= ( $date = get_post_meta( $post->ID, '_drop_price_dates_from', true ) ) ?  $date  : '';
    $drop_price_dates_to 	= ( $date = get_post_meta( $post->ID, '_drop_price_dates_to', true ) ) ?  $date  : '';

    I got this code to show the drop price timer on the homepage, but I want it to show the drop price timeframe. Any solution?

    add_action( 'woocommerce_after_shop_loop_item_title', 'wpgenie_show_counter_on_loop',50 );
    function wpgenie_show_counter_on_loop(){
    	global $product;
    	if(!isset ($product))
    		return;
    	if (isset($product->drop_price_counter) && ($product->drop_price_counter == 'yes') && isset($product->drop_price_next_drop) && $product->drop_price_next_drop){
    		echo '<div class="drop-price-counter">';
    		echo '<div class="drop-price-time" id="countdown">
    				<div class="drop-price-countdown" data-time="'.$product->drop_price_next_drop.'" data-productid="'.$product->id.'" ></div>
    			</div>';
    		echo "</div>";
    	}
    }
Viewing 1 replies (of 1 total)
  • Thread Starter jeffreyrb

    (@jeffreyrb)

    This works, but I want to add a class to style it. How do I add a class to it so I can add some CSS:

    add_action( 'woocommerce_after_shop_loop_item_title', 'wpgenie_show_counter_on_loop',50 );
    function wpgenie_show_counter_on_loop(){
    	global $post;				
    
    		echo '<div class="options_group hide_if_grouped">';
    
    		$drop_price_dates_from 	= ( $date = get_post_meta( $post->ID, '_drop_price_dates_from', true ) ) ?  $date  : '';
    		$drop_price_dates_to 	= ( $date = get_post_meta( $post->ID, '_drop_price_dates_to', true ) ) ?  $date  : '';
    
    		echo '	<p class="form-field drop_price_dates_fields">
    					<label for="_drop_price_dates_from">' . __( 'Resterende tijd:', 'drop_price' ) . '</label>
    					<input type="button" name="_drop_price_dates_to" id="_drop_price_dates_to" value="' . $drop_price_dates_to . '" placeholder="' . _x( 'To…', 'placeholder', 'drop_price' ) . '  YYYY-MM-DD HH:MM" maxlength="16" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])[ ](0[0-9]|1[0-9]|2[0-4]):(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])" />
    				</p>';
    		echo '</div>';		
    
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Plugin: Woocommerce Drop Price Plugin Timeframe End Date’ is closed to new replies.