Skip to content

Instantly share code, notes, and snippets.

@elicus
Created December 28, 2020 06:58
Show Gist options
  • Save elicus/514928ed8508bcbd5ce2b5ce6768f91e to your computer and use it in GitHub Desktop.
Save elicus/514928ed8508bcbd5ce2b5ce6768f91e to your computer and use it in GitHub Desktop.
/* Add Show/Hide Add to Cart button option */
if ( ! function_exists( 'de_append_theme_customizer' ) ) {
function de_append_theme_customizer( $wp_customize ) {
$wp_customize->add_setting( 'et_divi[add_to_cart]', array(
'type' => 'option',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'wp_validate_boolean',
) );
$wp_customize->add_control( 'et_divi[add_to_cart]', array(
'label' => esc_html__( 'Enable Add To Cart', 'Divi' ),
'section' => 'woocommerce_product_catalog',
'type' => 'checkbox',
) );
}
add_action( 'customize_register', 'de_append_theme_customizer' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment