Skip to content

Commit

Permalink
add woocommerce support
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanrajseo committed Mar 20, 2023
1 parent 24ff734 commit de8553c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 24 deletions.
26 changes: 2 additions & 24 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,30 +201,6 @@ function carbon_block_editor_styles() {
add_action( 'enqueue_block_editor_assets', 'carbon_block_editor_styles' );


add_action( 'after_setup_theme', 'carbon_setup_woocommerce' );
/**
* Set up WooCommerce
*
* @since 0.0.2
*/
function carbon_setup_woocommerce() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}

// Add support for WC features.
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );

// Remove default WooCommerce wrappers.
//remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
//remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
//add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 50 );
}


/**
* Custom template tags for this theme.
*/
Expand All @@ -238,6 +214,8 @@ function carbon_setup_woocommerce() {
require get_parent_theme_file_path( '/inc/general.php' );
// Sidebar or Widgets Functions
require get_parent_theme_file_path( '/inc/widgets.php' );
// Sidebar or Widgets Functions
require get_parent_theme_file_path( '/inc/woocommerce.php' );

// Add support for excerpt in Page
add_post_type_support( 'page', 'excerpt' );
Expand Down
1 change: 1 addition & 0 deletions inc/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

37 changes: 37 additions & 0 deletions inc/woocommerce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Woocommerce Specific features and functions.
*
* @link
*
* @package Carbon
* @since 0.0.1
* @version 0.0.2
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

add_action( 'after_setup_theme', 'carbon_setup_woocommerce' );
/**
* Set up WooCommerce
*
* @since 0.0.2
*/
function carbon_setup_woocommerce() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}

// Add support for WC features.
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );

// Remove default WooCommerce wrappers.
//remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
//remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
//add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 50 );
}

0 comments on commit de8553c

Please sign in to comment.