Skip to content

Commit

Permalink
Make it possible to disable cross-sell on cart page
Browse files Browse the repository at this point in the history
To be able to select whether to have the cross-sell active on the cart
page an admin configuration is created under Stores > Configuration >
Sales > Checkout > Shopping Cart.

The default for this setting is set to Yes (Show cross-sell items). This
is for backwards compatibility and not have webshop owners accidentally
not showing these items.

Because this is now sorted as the 3rd configuration in this
section/group the extra configurations for the grouped product image and
the configurable product image are now also increased.

This feature will make it possible to have this cross-sell turned off
during special sales, A/B testing or in a specific store view.
  • Loading branch information
arnoudhgz committed Jul 6, 2018
1 parent 7f43369 commit 516566a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Checkout/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<field id="number_items_to_display_pager" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Number of Items to Display Pager</label>
</field>
<field id="crosssell_enabled" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Show Cross-sell Items in the Shopping Cart</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
<group id="cart_link" translate="label" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0">
<label>My Cart Link</label>
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Checkout/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<delete_quote_after>30</delete_quote_after>
<redirect_to_cart>0</redirect_to_cart>
<number_items_to_display_pager>20</number_items_to_display_pager>
<crosssell_enabled>1</crosssell_enabled>
</cart>
<cart_link>
<use_qty>1</use_qty>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Checkout/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,5 @@ Payment,Payment
"Not yet calculated","Not yet calculated"
"We received your order!","We received your order!"
"Thank you for your purchase!","Thank you for your purchase!"
"Password", "Password"
Password,Password
"Show Cross-sell Items in the Shopping Cart","Show Cross-sell Items in the Shopping Cart"
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
</block>
<container name="checkout.cart.widget" as="checkout_cart_widget" label="Shopping Cart Items After"/>
</container>
<block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-">
<block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-" ifconfig="checkout/cart/crosssell_enabled">
<arguments>
<argument name="type" xsi:type="string">crosssell</argument>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<system>
<section id="checkout">
<group id="cart">
<field id="configurable_product_image" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<field id="configurable_product_image" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Configurable Product Image</label>
<source_model>Magento\Catalog\Model\Config\Source\Product\Thumbnail</source_model>
</field>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/GroupedProduct/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<system>
<section id="checkout" translate="label" type="text" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1">
<group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="grouped_product_image" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<field id="grouped_product_image" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Grouped Product Image</label>
<source_model>Magento\Catalog\Model\Config\Source\Product\Thumbnail</source_model>
</field>
Expand Down

0 comments on commit 516566a

Please sign in to comment.