Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4558428
Issue with Pdoduct Options + Price by Quantity
Open

Comments

  •  1
    Odilon started the conversation

    When I have a product with price by quantity and product option that are charged, the subtotal in the product page isn't calculating right. In the cart it whoes the correct price but int he product page it doesn't. The product price doesn't change acconding to the quantity in the subtotal section.

    Attached files:  Captura de tela 2026-04-14 113204.png

  •  1,688
    Dustin replied

    Hi Odilon,

    We provide premium support exclusively for users who have purchased the premium plugin https://wpclever.net/downloads/product-options/. Please provide your license key or email so I can verify your purchase.

    Best regards,
    Dustin

  •  1
    Odilon replied

    I found a lot of tickets with the same issue, updated today to the latest version 5.3.9 and issue continues. Tried different themes and issue continues :(

  •  1
    Odilon replied

    I developed (witht the help of IA) this PHP snippet, and it fixed the issue:


    add_action('wp_footer', function () {
        if (is_admin() || !is_product()) return;
        ?>
        <style>
            .wpcpo-col2,
            .wpcpo-subtotal-amount {
                position: relative;
                display: inline-block;
                min-width: 92px;
                transition: opacity .18s ease, transform .18s ease;
                will-change: opacity, transform;
            }

            .wpcpo-col2.is-price-loading,
            .wpcpo-subtotal-amount.is-price-loading {
                color: transparent !important;
            }

            .wpcpo-col2.is-price-loading > *,
            .wpcpo-subtotal-amount.is-price-loading > * {
                opacity: 0 !important;
            }

            .wpcpo-col2.is-price-loading::after,
            .wpcpo-subtotal-amount.is-price-loading::after {
                content: "";
                position: absolute;
                left: 0;
                top: 50%;
                transform: translateY(-50%);
                width: 88px;
                height: 1.05em;
                border-radius: 999px;
                background: linear-gradient(
                    100deg,
                    rgba(160,160,160,.14) 20%,
                    rgba(200,200,200,.28) 38%,
                    rgba(160,160,160,.14) 55%
                );
                background-size: 200% 100%;
                animation: wpcSkeletonShimmer 1.15s ease-in-out infinite;
                pointer-events: none;
            }

            .wpcpo-col2.is-price-enter,
            .wpcpo-subtotal-amount.is-price-enter {
                animation: wpcPriceFadeIn .22s ease;
            }

            @keyframes wpcSkeletonShimmer {
                0% { background-position: 200% 0; }
                100% { background-position: -200% 0; }
            }

            @keyframes wpcPriceFadeIn {
                0% {
                    opacity: 0;
                    transform: translateY(3px) scale(.985);
                }
                100% {
                    opacity: 1;
                    transform: translateY(0) scale(1);
                }
            }

            @media (prefers-reduced-motion: reduce) {
                .wpcpo-col2,
                .wpcpo-subtotal-amount {
                    transition: none !important;
                    animation: none !important;
                }

                .wpcpo-col2.is-price-loading::after,
                .wpcpo-subtotal-amount.is-price-loading::after {
                    animation: none !important;
                }

                .wpcpo-col2.is-price-enter,
                .wpcpo-subtotal-amount.is-price-enter {
                    animation: none !important;
                }
            }
        </style>

        <script>
        jQuery(function($){

            var wpcTimer = null;

            function mostrarSkeleton() {
                $('.wpcpo-col2, .wpcpo-subtotal-amount')
                    .removeClass('is-price-enter')
                    .addClass('is-price-loading');
            }

            function esconderSkeletonComFade() {
                var $els = $('.wpcpo-col2, .wpcpo-subtotal-amount');

                $els.removeClass('is-price-loading').addClass('is-price-enter');

                setTimeout(function(){
                    $els.removeClass('is-price-enter');
                }, 260);
            }

            function corrigirTotalWpc() {
                var $origem  = $('.wpcpq-summary').first();
                var $destino = $('.wpcpo-total').first();

                if (!$origem.length || !$destino.length) {
                    esconderSkeletonComFade();
                    return;
                }

                var qty  = $.trim($origem.find('.wpcpq-summary-qty').text());
                var nome = $.trim($origem.find('.wpcpq-summary-name').text());
                var precoHtml = $origem.find('.wpcpq-summary-total').html();

                if (!qty || !nome || !precoHtml) {
                    esconderSkeletonComFade();
                    return;
                }

                var $col1 = $destino.find('.wpcpo-col1').first();
                var $col2 = $destino.find('.wpcpo-col2').first();
                var $subtotal = $destino.find('.wpcpo-subtotal-amount').first();

                if ($col1.length) {
                    $col1.html('<span>' + qty + '×</span> ' + nome);
                }

                if ($col2.length) {
                    $col2.html('<strong>' + precoHtml + '</strong>');
                }

                if ($subtotal.length) {
                    $subtotal.html('Subtotal:' + precoHtml);
                }

                requestAnimationFrame(function(){
                    esconderSkeletonComFade();
                });
            }

            function atualizarComSkeleton() {
                mostrarSkeleton();

                if (wpcTimer) {
                    clearTimeout(wpcTimer);
                }

                wpcTimer = setTimeout(function() {
                    corrigirTotalWpc();
                }, 140);
            }

            setTimeout(function(){
                corrigirTotalWpc();
            }, 120);

            $(document).on('change', 'input, select, textarea', atualizarComSkeleton);
            $(document).on('input', 'input.qty', atualizarComSkeleton);
            $(document).on('click', '.plus, .minus, .wpcpo-clear-btn', atualizarComSkeleton);

            $(document.body).on('found_variation show_variation woocommerce_variation_has_changed', atualizarComSkeleton);
        });
        </script>
        <?php
    }, 999);