:::
Customized Products example β
The example shows how to integrate a Vue.js project with the logic provided by Customized Products plugin. This is ready to run project containing all needed tools to make Custom Products extension working in a headless approach.
Features β
- π Β
ProductCustomizedProductConfigurator.vuecomponent to use in a Vue project - π€οΈ Β
useProductCustomizedProductConfiguratorcomposable function to work with the logic enabled by a plugin
Requirements β
- A knowledge about Custom Products extension
- Custom Products extension available
- Some Vue.js project
Setup β
Setup your Vue template
Prepare some customized products following the documentation
Usage β
In the example, the product with Custom Product is found and used in the template.
<ProductCustomizedProductConfigurator /> component utilizes features from useProductCustomizedProductConfigurator which takes the product from app's context and take care of the state of selected options.
Import a component to display extended product options
jsimport ProductCustomizedProductConfigurator from "@/components/ProductCustomizedProductConfigurator.vue";Register a product in Shopware context:
js// product found by an api-client or a composable useProduct(product);Display the component
html<!-- your Vue template --> <ProductCustomizedProductConfigurator />
useProductCustomizedProductConfigurator API β
Available methods and properties provided by the composable function:
isActive - is customized product enabled
customizedProduct - the entire Product entity
state - state of the selected options
addToCart - method for adding product to cart, using customized options in the payload
handleFileUpload - helper for media type options, updates the state automatically
Investigate more in the component's source.
Run for development β
pnpm devor...
Resources β
Auto-generated
This page is generated from an external markdown file. In case of any issues or dead links, please visit the source file.