Skip to content

Commit

Permalink
Merge pull request #2247 from pronkoconsulting/1758-minicart-product-…
Browse files Browse the repository at this point in the history
…price-fix

We should'nt display cart discounts on product in side cart #1758
  • Loading branch information
pkarw committed Jan 18, 2019
2 parents b9ab1eb + 39bb784 commit d921973
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"setCustomProductOptions": true,
"setConfigurableProductOptions": true,
"askBeforeRemoveProduct": true,
"displayItemDiscounts": true,
"create_endpoint": "http://localhost:8080/api/cart/create?token={{token}}",
"updateitem_endpoint": "http://localhost:8080/api/cart/update?token={{token}}&cartId={{cartId}}",
"deleteitem_endpoint": "http://localhost:8080/api/cart/delete?token={{token}}&cartId={{cartId}}",
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/basics/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ If this option is set to `true`, in case of custom-options supporting products,

If this option is set to `true`, in case of configurable products, Vue Storefront will add the main SKU to the shopping cart and set the `product_option` sub-object of the shopping cart item to currently configured set of configurable options (for example color and size). Otherwise the simple product (accordingly to the selected configurable_options) will be added to the shopping cart instead.

```json
"displayItemDiscounts": true
```

If this option is set to `true`, Vue Storefront will add use price item with discount to the shopping cart. Otherwise the product price and special will be added to the shopping cart instead.

```json
"create_endpoint": "http://localhost:8080/api/cart/create?token={{token}}",
"updateitem_endpoint": "http://localhost:8080/api/cart/update?token={{token}}&cartId={{cartId}}",
Expand Down
13 changes: 10 additions & 3 deletions src/themes/default/components/core/blocks/Microcart/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
</div>
</div>
<div class="flex py15 mr10 align-right start-xs between-sm actions">
<div v-if="!product.totals">
{{ displayItemDiscounts }}
<div class="prices" v-if="!displayItemDiscounts">
<span class="h4 serif cl-error price-special" v-if="product.special_price">
{{ product.priceInclTax * product.qty | price }}&nbsp;
</span>
Expand All @@ -63,7 +64,7 @@
{{ product.priceInclTax * product.qty | price }}
</span>
</div>
<div v-if="product.totals">
<div class="prices" v-if="product.totals && displayItemDiscounts">
<span class="h4 serif cl-error price-special" v-if="product.totals.discount_amount">
{{ product.totals.row_total_incl_tax - product.totals.discount_amount | price }}&nbsp;
</span>
Expand All @@ -87,6 +88,7 @@
</template>

<script>
import rootStore from '@vue-storefront/store'
import Product from '@vue-storefront/core/compatibility/components/blocks/Microcart/Product'
import EditButton from './EditButton'
Expand All @@ -97,7 +99,12 @@ export default {
EditButton,
RemoveButton
},
mixins: [Product]
mixins: [Product],
data () {
return {
displayItemDiscounts: rootStore.state.config.cart.displayItemDiscounts
}
}
}
</script>

Expand Down

0 comments on commit d921973

Please sign in to comment.