Home Forums Pre-Sale Duplicate Price

Duplicate Price

  • Author
    Posts
  • #240675

    Robert Cox
    Participant

    CURCY plugin is causing a duplicate “collectors price” on the product page.

    This is the function we use to show the collectors price:

    function show_collectors_price_styled($atts) {
    global $product;

    if (!$product || !$product->is_type(‘simple’)) {
    return ”;
    }

    if ($product->get_stock_status() === ‘pre-order’) {
    return ”;
    }

    $price = $product->is_on_sale()
    ? $product->get_sale_price()
    : $product->get_regular_price();

    $price_inc_vat = wc_get_price_including_tax($product, [‘price’ => $price]);
    $price_ex_vat = wc_get_price_excluding_tax($product, [‘price’ => $price]);
    $is_vat_applicable = WC()->customer->get_is_vat_exempt() ? false : true;

    $collectors_price = $is_vat_applicable ? ($price_inc_vat * 0.90) : ($price_ex_vat * 0.90);

    // CURCY-safe output
    $raw_price_html = wc_price($collectors_price);
    $clean_price_html = str_replace(‘woocommerce-Price-amount’, ‘collectors-price-amount’, $raw_price_html);

    return ‘<div style=”border: 2px solid black; padding: 5px 10px; display: inline-block; border-radius: 8px; font-size: 14px; font-weight: bold;”>’
    . ‘Collector\’s Price: ‘ . $clean_price_html . ‘</div>’
    . ‘<br><small style=”font-size: 12px; display: block; margin-top: 5px;”>Click here to join for free</small>’;
    }
    add_shortcode(‘collectors_price’, ‘show_collectors_price_styled’);

    When CURCY is disabled the price does not appear duplicated.

    You can check the duplicate collectors on any product page like https://model-universe.com/product/norev-118-mercedes-amg-gt-black-series-blue-metallic-2021/

    Thank you in advance!

You must be logged in to see replies to this topic. Click here to login or register