PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / LayoutConfigurator / PreviewProduct.php

PreviewProduct.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Addons/LayoutConfigurator/PreviewProduct.php

32 lines 964 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\LayoutConfigurator;
2
3 use WC_Product_Simple;
4
5 /**
6 * In-memory product for the layout preview: a fixed price and no database row. Registered with
7 * WooCommerce's product factory for its id (see LayoutPreview::getProduct()), so wc_get_product() calls
8 * inside the renderer resolve to it as well.
9 */
10 class PreviewProduct extends WC_Product_Simple {
11
12 /**
13 * Id no stored product uses.
14 */
15 const ID = 2000000000;
16
17 public function __construct( $product = 0 ) {
18 parent::__construct( 0 ); // no data store read
19
20 $this->set_id( self::ID );
21 $this->set_props( array(
22 'name' => __( 'Preview product', 'tier-pricing-table' ),
23 'status' => 'publish',
24 'catalog_visibility' => 'visible',
25 'regular_price' => (string) LayoutPreview::PRICE,
26 'price' => (string) LayoutPreview::PRICE,
27 'stock_status' => 'instock',
28 ) );
29 $this->set_object_read( true );
30 }
31 }
32