Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (30 sloc) 775 Bytes
class="o-button o-button--secondary"
{{ label }}
import store from "../store";
export default {
computed: {
label: function() {
return store.getters.getProductIsInShoppingCart(this.product)
? "Remove from cart"
: "Add to cart";
props: ["product"],
methods: {
toggleShoppingCartState: function(product) {
store.commit("toggleShoppingCartState", product);
let message = store.getters.getProductIsInShoppingCart(this.product)
? `${product.title} has been added to from cart`
: `${product.title} has been removed from cart`;
You can’t perform that action at this time.