File tree 7 files changed +42
-10864
lines changed
view/frontend/templates/cart
design/frontend/Magento/luma/web/css/source 7 files changed +42
-10864
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ class Grid extends \Magento\Checkout\Block\Cart
22
22
*/
23
23
const XPATH_CONFIG_NUMBER_ITEMS_TO_DISPLAY_PAGER = 'checkout/cart/number_items_to_display_pager ' ;
24
24
25
+ /**
26
+ * Default display setting for clear shopping cart button
27
+ */
28
+ const XPATH_CONFIG_ENABLE_CLEAR_SHOPPING_CART = 'checkout/cart/enable_clear_shopping_cart ' ;
29
+
25
30
/**
26
31
* @var \Magento\Quote\Model\ResourceModel\Quote\Item\Collection
27
32
*/
@@ -174,4 +179,17 @@ private function isPagerDisplayedOnPage()
174
179
}
175
180
return $ this ->isPagerDisplayed ;
176
181
}
182
+
183
+ /**
184
+ * Check if clear shopping cart button is enabled
185
+ *
186
+ * @return bool
187
+ */
188
+ public function isClearShoppingCartEnabled ()
189
+ {
190
+ return (bool ) $ this ->_scopeConfig ->getValue (
191
+ self ::XPATH_CONFIG_ENABLE_CLEAR_SHOPPING_CART ,
192
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
193
+ );
194
+ }
177
195
}
Original file line number Diff line number Diff line change 48
48
<label >Show Cross-sell Items in the Shopping Cart</label >
49
49
<source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
50
50
</field >
51
+ <field id =" enable_clear_shopping_cart" translate =" label" type =" select" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
52
+ <label >Enable Clear Shopping Cart</label >
53
+ <source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
54
+ </field >
51
55
</group >
52
56
<group id =" cart_link" translate =" label" sortOrder =" 3" showInDefault =" 1" showInWebsite =" 1" >
53
57
<label >My Cart Link</label >
Original file line number Diff line number Diff line change 19
19
<redirect_to_cart >0</redirect_to_cart >
20
20
<number_items_to_display_pager >20</number_items_to_display_pager >
21
21
<crosssell_enabled >1</crosssell_enabled >
22
+ <enable_clear_shopping_cart >0</enable_clear_shopping_cart >
22
23
</cart >
23
24
<cart_link >
24
25
<use_qty >1</use_qty >
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ Shipping,Shipping
153
153
"Maximum Number of Items to Display in Order Summary","Maximum Number of Items to Display in Order Summary"
154
154
"Quote Lifetime (days)","Quote Lifetime (days)"
155
155
"After Adding a Product Redirect to Shopping Cart","After Adding a Product Redirect to Shopping Cart"
156
+ "Enable Clear Shopping Cart","Enable Clear Shopping Cart"
156
157
"Number of Items to Display Pager","Number of Items to Display Pager"
157
158
"My Cart Link","My Cart Link"
158
159
"Display Cart Summary","Display Cart Summary"
Original file line number Diff line number Diff line change 56
56
<span><?= $ block ->escapeHtml (__ ('Continue Shopping ' )) ?> </span>
57
57
</a>
58
58
<?php endif ; ?>
59
- <button type="button"
60
- name="update_cart_action"
61
- data-cart-empty=""
62
- value="empty_cart"
63
- title="<?= $ block ->escapeHtml (__ ('Clear Shopping Cart ' )) ?> "
64
- class="action clear" id="empty_cart_button">
65
- <span><?= $ block ->escapeHtml (__ ('Clear Shopping Cart ' )) ?> </span>
66
- </button>
59
+ <?php if ($ block ->isClearShoppingCartEnabled ()) :?>
60
+ <button type="button"
61
+ name="update_cart_action"
62
+ data-cart-empty=""
63
+ value="empty_cart"
64
+ title="<?= $ block ->escapeHtml (__ ('Clear Shopping Cart ' )) ?> "
65
+ class="action clear" id="empty_cart_button">
66
+ <span><?= $ block ->escapeHtml (__ ('Clear Shopping Cart ' )) ?> </span>
67
+ </button>
68
+ <?php endif ?>
67
69
<button type="submit"
68
70
name="update_cart_action"
69
71
data-cart-item-update=""
Original file line number Diff line number Diff line change 1570
1570
margin-bottom : @indent__base ;
1571
1571
1572
1572
.actions.main {
1573
- .continue ,
1574
- .clear {
1573
+ .continue {
1575
1574
display : none ;
1576
1575
}
1576
+
1577
+ .clear {
1578
+ .lib-button-as-link (
1579
+ @_margin : 0 @indent__base 0 0
1580
+ );
1581
+ font-weight : @font-weight__regular ;
1582
+ }
1577
1583
}
1578
1584
}
1579
1585
}
You can’t perform that action at this time.
0 commit comments