0

I have a Craft 3 site, currently running using the Element API and Vue JS as follows:

VueJS: Product grid component

...
mounted(){
    this.getGridProducts()
},
data() {
    return {
        products: [],
    }
},
methods: {
    getGridProducts(){
        axios.get(window.endpoint)
        .then(response => {
            this.products = response.data.data
        })
    },
}

Twig: index.html template

{% extends './_layout' %}
{% block content %}
    ...
    <product-grid 
    :cols="3" 
    :fluid="false" 
    :sidebar="false"
    :button="true"
    :title="'Productos destacados'"></product-grid>
{% endblock %}

{% block scripts %}
<script>
    window.endpoint = '/products/featured/9.json';
    window.currentPage = 'Inicio'
</script>
{% endblock %}

That's pretty much what happens in every view with products. Initially this was more then enough, but now my client wants to move on to an e-commerce strategy using Shopify.

I'm reading up on Shopify JavaScript Buy SDK which seems pretty powerful. Still, I was wondering what the most efficient way to set this up might be, especially regarding urls and product IDs. Should I add a new "Shopify ID" field to each product so that I can retrieve the information from Shopify? What about updating the product's price? Does it have to be updated in both platforms?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.