Magento – Magento 1.9.3 : How to display custom options price (separately) on cart and checkout page

cartcheckoutcustom-optionsmagento-1.9shopping-cart

I want to display custom option price on cart and checkout page.

I follow this URL but its display error "Fatal error: Call to a member function getValue() on a non-object " on

app/design/frontend/default/theme/template/checkout/cart/item/default.phtml

    $optionId = $_option['option_id'];
    $product = $_item->getProduct();
    $option = $product->getOptionById($optionId);
    $itemOption = $_item->getOptionByCode('option_' . $option->getId());
    $price = false;
    foreach ($option->getValues() as $values) {
        if ($values->getId() == $itemOption['value']) {
            $price = $values->price;
        }
    }
    if ($price !== false) {
        echo Mage::helper('core')->currency($price);
    }

Reference URL : https://stackoverflow.com/questions/11966256/magento-custom-options-showing-price-in-cart-checkout-page

I have another requirement with custom option price on cart and checkout page.

Please open below link and check "Interested in Embroidery" checkbox. Some options will show which are product custom options.
Here, two options have price "Logo Creation Fee" and "Embroidery Logo Charge". When I select all options and add to cart. On cart page, If I increase product quantity, all option's price increase with quantity. But I want that when product quantity increase, only "Embroidery Logo Charge ($35)" custom option varies with quantity not "Logo Creation Fee($300)".

Example: If the product price is $50 and product have two custom options like- " Logo Creation Fee ($300)" and "Embroidery Logo Charge($35)". When we add the product(quantity 1) in a cart with both custom options (subtotal is $385).

Subtotal is: (product price ($50) + Logo Creation Fee ($300) + Embroidery Logo Charge($35)) * 1 = $385

Now, we increase product quantity (2) then subtotal is :

Subtotal is: (product price ($50) + Logo Creation Fee ($300) + Embroidery Logo Charge($35)) * 2 = $770

But I want to change in subtotal. I want subtotal like this :

Subtotal is: ((product price ($50) + Embroidery Logo Charge($35)) * 2) + Logo Creation Fee ($300) = $470 ($170 + $300)

"Logo Creation Fee ($300)" not vary with quantity, add only one quantity for one product.

Means Product's "Unit Price" display without custom option's price.

Demo URL : http://superbuniforms.com/magento/medical-lab-coat-unisex-sky-blue.html

Please suggest.

Thanks!

Best Answer

You need to override the phtml file, and add the custom price.

app\design\frontend\venoder\theme\Magento_Catalog\templates\product\view\addtocart.phtml.

Related Topic