core
css
epanel
et-pagebuilder
images
includes
builder
api
compat
feature
frontend-builder
assets
build
i18n
theme-builder
ThemeBuilderApiErrors.php
ThemeBuilderRequest.php
WoocommerceProductVariablePlaceholder.php
WoocommerceProductVariablePlaceholderDataStoreCPT.php
WoocommerceProductVariationPlaceholder.php
admin.php
api.php
dynamic-content.php
frontend-body-template.php
frontend-footer-template.php
frontend-header-template.php
frontend.php
template-setting-validations.php
theme-builder.php
woocommerce.php
wpml.php
LICENSE.md
assets.php
bfb-template.php
helpers.php
i18n.php
init.php
rtl.php
view.php
images
languages
module
plugin-compat
post
scripts
styles
templates
tests
theme-compat
_et_builder_version.php
ab-testing.php
autoload.php
class-et-builder-dynamic-assets-feature.php
class-et-builder-element.php
class-et-builder-global-feature-base.php
class-et-builder-google-fonts-feature.php
class-et-builder-module-features.php
class-et-builder-module-shortcode-manager.php
class-et-builder-module-use-detection.php
class-et-builder-plugin-compat-base.php
class-et-builder-plugin-compat-loader.php
class-et-builder-post-feature-base.php
class-et-builder-settings.php
class-et-builder-theme-compat-base.php
class-et-builder-theme-compat-handler.php
class-et-builder-value.php
class-et-global-settings.php
comments_template.php
conditions.php
core.php
deprecations.php
framework.php
functions.php
main-structure-elements.php
template-preview.php
functions
module-customizer
widgets
block-editor-integration.php
navigation.php
no-results.php
social_icons.php
theme-builder.php
widgets.php
js
lang
psd
404.php
CREDITS.md
LICENSE.md
README.md
changelog.txt
comments.php
composer.json
footer.php
functions.php
header.php
index.php
options_divi.php
page-template-blank.php
page.php
post_thumbnails_divi.php
screenshot.jpg
sidebar-footer.php
sidebar.php
single-et_pb_layout.php
single-project.php
single.php
style-cpt-rtl.min.css
style-cpt.min.css
style-rtl.min.css
style-static-cpt-rtl.min.css
style-static-cpt.min.css
style-static-rtl.min.css
style-static.min.css
style.css
style.min.css
theme-after-footer.php
theme-after-header.php
theme-after-wrappers.php
theme-before-wrappers.php
theme-footer.php
theme-header.php
wpml-config.xml
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Register data store for ET_Theme_Builder_Woocommerce_Product_Variable_Placeholder_Data_Store_CPT
|
|
* which aims to bypass database value retrieval and simply returns default value as placeholder
|
|
*
|
|
* @since 4.0.10
|
|
*/
|
|
class ET_Theme_Builder_Woocommerce_Product_Variable_Placeholder_Data_Store_CPT extends WC_Product_Variable_Data_Store_CPT implements WC_Object_Data_Store_Interface, WC_Product_Variable_Data_Store_Interface {
|
|
/**
|
|
* Basically the original read() method with one exception: retruns default value (which is
|
|
* placeholder value) and remove all database value retrieval mechanism so any add-ons
|
|
* on TB refers to TB placeholder product data
|
|
*
|
|
* @since 4.0.10
|
|
*
|
|
* @param WC_Product $product Product object.
|
|
*/
|
|
public function read( &$product ) {
|
|
$product->set_defaults();
|
|
}
|
|
|
|
/**
|
|
* Register product type data store
|
|
*
|
|
* @since 4.0.10
|
|
* @since 4.3.3 register the store for tb-placeholder-variation product
|
|
*
|
|
* @param array $stores
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function register_store( $stores ) {
|
|
$stores['product-tb-placeholder'] = 'ET_Theme_Builder_Woocommerce_Product_Variable_Placeholder_Data_Store_CPT';
|
|
|
|
// Placeholder variation store requirement is identical to placeholder variable, which is
|
|
// loading defaults as value and skipping database value retrieval; thus best keep thing
|
|
// simple and reuse it for tb-placeholder-variation
|
|
$stores['product-tb-placeholder-variation'] = 'ET_Theme_Builder_Woocommerce_Product_Variable_Placeholder_Data_Store_CPT';
|
|
|
|
return $stores;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Register product tb-placeholder's store
|
|
*
|
|
* @since 4.0.10
|
|
*/
|
|
add_filter(
|
|
'woocommerce_data_stores',
|
|
array( 'ET_Theme_Builder_Woocommerce_Product_Variable_Placeholder_Data_Store_CPT', 'register_store' )
|
|
);
|