bigcommerce-for-wordpress
bigcommerce-for-wordpress copied to clipboard
Adds support for fetching BigCommerce Products by SKU. Including via shortcode
Adds support for fetching BigCommerce Products by SKU.
- Adds static methods
by_product_skuandqueryto theBigCommerce\Post_Types\Productclass - Add default attribute of
skuto theProduct_Componentsclass implementing thebc-componentshortcode
Documentation
Historically, one would only be able to fetch a product with a BigCommerce Product ID
E.g. $product = \BigCommerce\Post_Types\Product\Product::by_product_id( $product_id );
This pull request adds the ability to fetch of a product in a very similar fashion by BigCommerce Product SKU
E.g. $product = \BigCommerce\Post_Types\Product\Product::by_product_sku( $product_sku );
Additionally, the bc-component shortcode attributes have been updated to support fetching by BigCommerce Product SKU as well.
E.g. echo do_shortcode('[bc-component sku="' . $product_sku . '" type="add_to_cart"]');