: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Price class
* The ET_Builder_Module_Woocommerce_Price Class is responsible for rendering the
* Price markup using the WooCommerce template.
* Class representing WooCommerce Price component.
class ET_Builder_Module_Woocommerce_Price extends ET_Builder_Module {
$this->name = esc_html__( 'Woo Price', 'et_builder' );
$this->plural = esc_html__( 'Woo Prices', 'et_builder' );
// Use `et_pb_wc_{module}` for all WooCommerce modules.
$this->slug = 'et_pb_wc_price';
$this->vb_support = 'on';
$this->settings_modal_toggles = array(
'main_content' => et_builder_i18n( 'Content' ),
* Manually define `text` to avoid `Text Text` toggle defined by advanced
* field font which automatically append ` Text` by default.
'title' => esc_html__( 'Price Text', 'et_builder' ),
$this->advanced_fields = array(
'label' => esc_html__( 'Price', 'et_builder' ),
'main' => '%%order_class%% .price',
'important' => array( 'size' ),
'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em',
'hide_text_align' => true,
'before_sale_price' => array(
'label' => esc_html__( 'Sale Old Price', 'et_builder' ),
'main' => '%%order_class%% .price del',
'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em',
'hide_text_align' => true,
'label' => esc_html__( 'Sale New Price', 'et_builder' ),
'main' => '%%order_class%% .price ins',
'important' => array( 'font' ),
'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em',
'default' => '|700|||||||',
'hide_text_align' => true,
'margin_padding' => array(
* Module has default margin-bottom which adapts to column it currently in
* thus, stronger selector needed for module's custom styling to overwrite it.
'margin' => '.et_pb_row .et_pb_column div%%order_class%%',
'text_shadow' => '%%order_class%%',
'background_layout' => array(
// Assign to main font advanced field (body), keeping things simplified
// Don't add text-shadow fields since they already are via font-options
$this->custom_css_fields = array(
'label' => esc_html__( 'Price', 'et_builder' ),
'before_sale_price' => array(
'label' => esc_html__( 'Sale Old Price', 'et_builder' ),
'selector' => '.price del',
'label' => esc_html__( 'Sale New Price', 'et_builder' ),
'selector' => '.price ins',
$this->help_videos = array(
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
public function get_fields() {
'product' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'default' => ET_Builder_Module_Helper_Woocommerce_Modules::get_product_default(),
'computed_affects' => array(
'product_filter' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'computed_affects' => array(
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Price',
'computed_depends_on' => array(
'computed_minumum' => array(
* @param array $args Arguments from Computed Prop AJAX call.
* @param array $conditional_tags Conditional Tags.
* @param array $current_page Current page args.
public static function get_price( $args = array(), $conditional_tags = array(), $current_page = array() ) {
return et_builder_wc_render_module_template( 'woocommerce_template_single_price', $args );
* Renders the module output.
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
public function render( $attrs, $content = null, $render_slug ) {
$this->add_classname( $this->get_text_orientation_classname() );
$output = self::get_price( $this->props );
// Render empty string if no output or no price value are generated
// to avoid unwanted vertical space.
if ( '' === trim( $output ) || '<p class="price"></p>' === trim( $output ) ) {
return $this->_render_module_wrapper( $output, $render_slug );
new ET_Builder_Module_Woocommerce_Price();