A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

2

Use below code $total = $array['amount'] - $arr['base_grand_total']; $sortedData = $prepaidModel->getCollection()->addFieldToFilter('customer_id',1); foreach($sortedData as $sData) { $sData->setData('amount',$total); $sData->save(); }


2

On the product page you can use a customer data in js: require('Magento_Customer/js/customer-data').get('cart')().items This is a preferred way because if you load that items on the backend (php) it will not work with a full page cache.


2

For the cart page First, override this file in your module or theme Path: vendor/magento/module-checkout/view/frontend/templates/cart/item/default.phtml Find the element <div class="control qty"> and replace it with below code <div class="control qty"> <input id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty" ...


1

I guess that you tried to get Cart items $block->getCustomerQuoteItems() using Checkout session. Your code $block->getCustomerQuoteItems() does not give right data when FPC cache enable at your system. Will be right cart details on non -cacheable pages like cart & checkout,my account pages etc. At Magento for getting right cart data/ Customer ...


1

Below is an example of save multiple model instances at once. Try with below example class yourClassName extends \Magento\Framework\Model\AbstractModel { public function __construct( ............ \Magento\Framework\DB\TransactionFactory ............ ) { ............ $this->transactionFactory = $transactionFactory; ..........


1

Create after plugin for Magento\Checkout\Controller\Cart\Add.php namespace Vendor\Module\Plugin; class AddToCart { public function __construct( \Magento\Checkout\Model\Session $checkoutSession ) { $this->checkoutSession = $checkoutSession; } public function afterExecute(\Magento\Checkout\Controller\Cart\Add $subject, $result) ...


1

You have to override the below path in your custom theme Base file path : vendor/magento/module-checkout/view/frontend/templates/cart/item/configure/updatecart.phtml Move To Theme file path app/design/frontend/<VENDOR_NAME>/<THEME_NAME>/Magento_Checkout/templates/cart/item/configure/updatecart.phtml And add this below text in the input &...


Only top voted, non community-wiki answers of a minimum length are eligible