• inewton24

    (@inewton24)


    Hello! What do u think about display this price history in the cart and checkout page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author kkarpieszuk

    (@kkarpieszuk)

    hi, thanks. Maybe it is a good idea. How would you like to see it? Just next to the product page, crossed out, yes?

    Thread Starter inewton24

    (@inewton24)

    I think this will definitely be a good option! Some shops already have price history on cart page and checkout page. Usually the lowest price is simply listed below the regular price

    Thread Starter inewton24

    (@inewton24)

    I wrote this code and it works 🙂
    U can add this snippet as option in ur plugin to options page and add in code some variables as “Minimal price text” and other texts

    function add_price_history_to_cart_item( $product_name, $cart_item, $cart_item_key ) {
    // Get the product ID
    $product_id = $cart_item[‘product_id’];

    // Append the price history shortcode below the product price
    $price_history = do_shortcode( '[wc_price_history id="' . $product_id . '"]' );
    
    // Return the product name with the price history appended
    return $product_name . '<div class="wc-price-history">' . $price_history . '</div>';

    }

    // Hook into WooCommerce to modify the product name in the cart
    add_filter( ‘woocommerce_cart_item_name’, ‘add_price_history_to_cart_item’, 10, 3 );

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this review.