diff --git a/example/remote-data-blocks-example-code.php b/example/remote-data-blocks-example-code.php index 494d1af4..fd1edb06 100644 --- a/example/remote-data-blocks-example-code.php +++ b/example/remote-data-blocks-example-code.php @@ -37,6 +37,7 @@ function load_only_if_parent_plugin_is_active() { require_once __DIR__ . '/github/remote-data-blocks/register.php'; require_once __DIR__ . '/rest-api/art-institute/register.php'; require_once __DIR__ . '/rest-api/zip-code/register.php'; + require_once __DIR__ . '/shopify/register.php'; require_once __DIR__ . '/google-sheets/westeros-houses/register.php'; } add_action( 'plugins_loaded', __NAMESPACE__ . '\\load_only_if_parent_plugin_is_active', 10, 0 ); diff --git a/example/shopify/register.php b/example/shopify/register.php new file mode 100644 index 00000000..d86424cb --- /dev/null +++ b/example/shopify/register.php @@ -0,0 +1,29 @@ +warning( sprintf( '%s is not defined, cannot register %s block', 'EXAMPLE_SHOPIFY_ACCESS_TOKEN', $block_name ) ); + return; + } + + $shopify_data_source = ShopifyDataSource::create( $access_token, $store_name ); + $shopify_search_products_query = new ShopifySearchProductsQuery( $shopify_data_source ); + $shopify_get_product_query = new ShopifyGetProductQuery( $shopify_data_source ); + + register_remote_data_block( $block_name, $shopify_get_product_query ); + register_remote_data_search_query( $block_name, $shopify_search_products_query ); +} +add_action( 'init', __NAMESPACE__ . '\\register_shopify_block' );