How to get Magento 2 attribute value in cart?

I cannot get attribute value in checkout/cart in Magento 2.

I use the following code in customer orders page and I get the value but not in checkout/cart page.

This line return null : var_dump($ attribute->getFrontend()->getValue($ product));

$  _item = $  block->getItem(); $  product = $  _item->getProduct(); $  productAttributes = $  product->getAttributes(); $  attributeSetId = intval($  product->getAttributeSetId()); $  obj = \Magento\Framework\App\ObjectManager::getInstance(); /** @var \Magento\Catalog\Model\Config $  config */ $  config= $  obj->get('Magento\Catalog\Model\Config'); $  group_id = $  config->getAttributeGroupId($  attributeSetId, 'Display Attributes');  foreach ($  productAttributes as $  attribute) :     if ($  attribute->isInGroup($  attributeSetId, $  group_id)) :         var_dump($  attribute->getFrontendLabel());         var_dump($  attribute->getFrontend()->getValue($  product));     endif; endforeach; 

The attribute is visible for products lists and catalog.

Do you know why I can’t get the value in this page ?

want to confirm popup with “Yes” and “No” button when user click on add to cart

I am new in WordPress so need help… I want to show confirm popup with the button “Yes” and “No” when user clicks on Add to Cart. after selecting “Yes” on confirm Popup, add a product to cart. If user select “No” the close confirm popup and do nothing. Also, I want to show product data filed value on confirm popup body section.

Thanks in Advanced…

Can’t get BOGO to reflect in cart, but applies. HELP

I am trying to create a BOGO coupon in Magento. 2 things.

Is there a configuration to turn on the website field in the Cart Price Rules (it’s not available to me)?

When i create the BOGO, i can get it to apply in the shopping cart. But the subtotal doesn’t actually reflect that $ $ was discounted.

Right now I have it set up to discount the cart total 50% if X amount of products are in the cart. This seems very hacky, but the only way i could get it work on the cart $ $ .

Magento 2.2.3: Unable to add more than 1 qty product in the cart

I’ve created a custom theme and wishlist page looks like this enter image description here

Product is getting added in the cart for qty 1. But when I set qty more than 1, I am redirecting to the product detail page.

Here is my xml code


<?xml version="1.0"?> <!-- /**  * Copyright © Magento, Inc. All rights reserved.  * See COPYING.txt for license details.  */ --> <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">     <update handle="customer_account"/>     <body>         <referenceBlock name="customer.wishlist.button.toCart" remove="true" />          <referenceBlock name="head.components">             <block class="Magento\Framework\View\Element\Js\Components" name="wishlist_head_components" template="Magento_Wishlist::js/components.phtml"/>         </referenceBlock>         <referenceContainer name="content">             <block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="Magento_Wishlist::view.phtml" cacheable="false">                 <block class="Magento\Wishlist\Block\Rss\Link" name="" template="Magento_Wishlist::rss/wishlist.phtml"/>                 <block class="Magento\Wishlist\Block\Customer\Wishlist\Items" name="customer.wishlist.items" as="items" template="Magento_Wishlist::item/list.phtml" cacheable="false">                     <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image" name="customer.wishlist.item.image" template="Magento_Wishlist::item/column/image.phtml" cacheable="false"/>                     <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Info" name="" template="Magento_Wishlist::item/column/name.phtml" cacheable="false"/>                     <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.price" template="Magento_Wishlist::item/column/price.phtml" cacheable="false">                         <block class="Magento\Catalog\Pricing\Render" name="product.price.render.wishlist">                             <arguments>                                 <argument name="price_render" xsi:type="string">product.price.render.default</argument>                                 <argument name="price_type_code" xsi:type="string">wishlist_configured_price</argument>                                 <argument name="price_label" xsi:type="boolean">false</argument>                                 <argument name="zone" xsi:type="string">item_list</argument>                             </arguments>                         </block>                         <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Options" name="customer.wishlist.item.options" cacheable="false"/>                     </block>                     <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.inner" template="Magento_Wishlist::item/column/actions.phtml" cacheable="false">                         <arguments>                             <argument name="css_class" xsi:type="string">product-item-inners</argument>                         </arguments>                         <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Comment" name="customer.wishlist.item.comment" template="Magento_Wishlist::item/column/comment.phtml" cacheable="false">                             <arguments>                                 <argument name="title" translate="true" xsi:type="string">Product Details and Comment</argument>                             </arguments>                         </block>                         <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.cart" template="Magento_Wishlist::item/column/cart.phtml" cacheable="false">                             <arguments>                                 <argument name="title" translate="true" xsi:type="string">Add to Cart</argument>                             </arguments>                         </block>                          <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.actions" template="Magento_Wishlist::item/column/actions.phtml" cacheable="false">                             <arguments>                                 <argument name="css_class" xsi:type="string">product-item-actions</argument>                             </arguments>                             <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="Magento_Wishlist::button/update.phtml" cacheable="false"/>                             <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Remove" name="customer.wishlist.item.remove" template="Magento_Wishlist::item/column/remove.phtml" cacheable="false"/>                             <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="Magento_Wishlist::button/share.phtml" cacheable="false"/>                          </block>                     </block>                 </block>                 <container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="Magento_Wishlist::button/tocart.phtml" cacheable="false"/>                 </container>             </block>         </referenceContainer>     </body> </page> 

Drupal commerce 2 add to cart form not working for anonymous user

When anonymous users add a product to the cart it’s not working, but it works for authenticated users.

Following code is creating the form

  function mycustommodule_preprocess_commerce_product(array &$  variables)   {   // some code   $  service = \Drupal::service('commerce_product.lazy_builders');   $  variables['form_cart'] = $  service->addToCartForm($  product->id(),     'default', false, 'en');   } 

and in the template(commerce-product.html.twig) we have :

{{ form_cart }} 

The form is shown correctly but on submit to add to cart form nothing is added to cart when user is anonymous

Problems with button cart, and register in magento 2.3.1

Good Morning Every Body, I test my magento on ubuntu 18.04, In localhost, and i push the button a test product and he send a msg like this Your Session Expire , ok i going to register and when finish the form and send the information, he send too a error msg like this Invalid Form Key. Please refresh the page., What’s going on here?