1. Go to this page and download the library: Download venveo/craft-bigcommerce library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
venveo / craft-bigcommerce example snippets
use venveo\bigcommerce\events\BigCommerceProductSyncEvent;
use venveo\bigcommerce\services\Products;
use yii\base\Event;
Event::on(
Products::class,
Products::EVENT_BEFORE_SYNCHRONIZE_PRODUCT,
function(BigCommerceProductSyncEvent $event) {
// Example 1: Cancel the sync if a flag is set via a BigCommerce metafield:
if ($event->metafields['do_not_sync'] ?? false) {
$event->isValid = false;
}
// Example 2: Set a field value from metafield data:
$event->element->setFieldValue('myNumberFieldHandle', $event->metafields['cool_factor']);
}
);