├── README.md ├── archive-product.php ├── cart └── cart.php ├── custom_functions.php ├── product-categories.php ├── products-shop.php └── single-product.php /README.md: -------------------------------------------------------------------------------- 1 | # Woocommerce Custom Pages Development ⚡ 2 | Custom pages for wooocommerce that can be used to customize your Product, Category, Cart, Checkout and Myaccount Woocommerce pages. 3 | 4 | 🤝 SUBSCRIBE TO ▷ [YOUTUBE CHANNEL](https://www.youtube.com/c/ImranSayedDev?sub_confirmation=1) - to support my work 🙏 5 | 6 | 7 | 8 | ******* 🔗 CURRENT PLAYLIST 🔗 ****** 9 | 10 | 👉 https://codeytek.com/course/woocommerce-basics-and-customization-course/ 11 | 12 | 13 | ******* PLEASE STAR MY REPO TO SUPPORT ME ****** 14 | 15 | 👉 https://github.com/imranhsayed/woocommerce-custom-pages 16 | 17 | ******* Social Links ******** 18 | 19 | 20 | Please follow 🙏 21 | 22 | 👉 Twitter - [@imranhsayed](https://twitter.com/imranhsayed) 23 | 24 | 25 | 👉 Github - [imranhsayed](https://github.com/imranhsayed) 26 | 27 | 28 | Other Videos in this series: ▷ 29 | 30 | * ▷ [#1 Woocommerce Basics and Customization | WordPress](https://youtu.be/wuZRQRposTE?list=PLD8nQCAhR3tSX58ydx66s1LQhbHN86pWy) 31 | 32 | * ▷ [#2 Woocommerce Installation and Use | WordPress](https://youtu.be/2S6LRtA678Q) 33 | 34 | * ▷ [#3 Customize Woocommerce Product Page](https://youtu.be/YanyF5bjobQ) 35 | 36 | * ▷ [#4 Create Custom Woocommerce Product Page](https://youtu.be/XPbNd3kpvCA) 37 | 38 | * ▷ [#5 Create Custom Woocommerce Product Page Sorting Filter](https://youtu.be/1CquVG_O-Ng) 39 | 40 | * ▷ [#6 Custom WooCommerce Single Product Page](https://youtu.be/adQkthaZJxg) 41 | 42 | * ▷ [#7 Customize WooCommerce Category Page](https://youtu.be/ETJ2X2tWTlk) 43 | 44 | * ▷ [#8 Custom Woocommerce Product Category Single Page](https://youtu.be/TfC24hnLLMc) 45 | 46 | * ▷ [#9 Customize WooCommerce Checkout, Cart and Myaccount page](https://youtu.be/r80cUSJfo9Y) 47 | -------------------------------------------------------------------------------- /archive-product.php: -------------------------------------------------------------------------------- 1 | 31 |
32 | 33 |

34 | 35 | 36 | 45 |
46 | 59 | 60 |
61 |
62 | '; 76 | $img = ( get_the_post_thumbnail() ) ? get_the_post_thumbnail() : $default_img; 77 | $id = get_the_ID(); 78 | ?> 79 |
80 |
81 |

82 |
83 |
84 | 91 |
92 |
93 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | cart->get_cart() as $cart_item_key => $cart_item ) { 42 | $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); 43 | $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); 44 | 45 | if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) { 46 | $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); 47 | ?> 48 | 49 | 50 | 62 | 63 | 74 | 75 | 94 | 95 | 100 | 101 | 118 | 119 | 124 | 125 | 129 | 130 | 131 | 132 | 133 | 148 | 149 | 150 | 151 | 152 |
  
51 | ×', 55 | esc_url( wc_get_cart_remove_url( $cart_item_key ) ), 56 | __( 'Remove this item', 'woocommerce' ), 57 | esc_attr( $product_id ), 58 | esc_attr( $_product->get_sku() ) 59 | ), $cart_item_key ); 60 | ?> 61 | 64 | get_image(), $cart_item, $cart_item_key ); 66 | 67 | if ( ! $product_permalink ) { 68 | echo wp_kses_post( $thumbnail ); 69 | } else { 70 | printf( '%s', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) ); 71 | } 72 | ?> 73 | 76 | get_name(), $cart_item, $cart_item_key ) . ' ' ); 79 | } else { 80 | echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '%s', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) ); 81 | } 82 | 83 | do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key ); 84 | 85 | // Meta data. 86 | echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok. 87 | 88 | // Backorder notification. 89 | if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) { 90 | echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '

' . esc_html__( 'Available on backorder', 'woocommerce' ) . '

' ) ); 91 | } 92 | ?> 93 |
96 | cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. 98 | ?> 99 | 102 | is_sold_individually() ) { 104 | $product_quantity = sprintf( '1 ', $cart_item_key ); 105 | } else { 106 | $product_quantity = woocommerce_quantity_input( array( 107 | 'input_name' => "cart[{$cart_item_key}][qty]", 108 | 'input_value' => $cart_item['quantity'], 109 | 'max_value' => $_product->get_max_purchase_quantity(), 110 | 'min_value' => '0', 111 | 'product_name' => $_product->get_name(), 112 | ), $_product, false ); 113 | } 114 | 115 | echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok. 116 | ?> 117 | 120 | cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok. 122 | ?> 123 |
134 | 135 | 136 |
137 | 138 | 139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 |
153 | 154 |
155 | 156 |
157 | 166 |
167 | 168 | 169 | -------------------------------------------------------------------------------- /custom_functions.php: -------------------------------------------------------------------------------- 1 | 7 | 8 | 'product_cat', 12 | 'hide_empty' => false, 13 | ); 14 | $result = get_terms( $args ); 15 | ?> 16 | 17 |
18 |
19 | name ) { 22 | $term_link = get_term_link( $cat, 'product_cat' ); 23 | $cat_thumb_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); 24 | $shop_catalog_img_arr = wp_get_attachment_image_src( $cat_thumb_id, 'shop_catalog' ); 25 | $cat_img = $shop_catalog_img_arr[0]; 26 | ?> 27 |
28 |
29 | 30 |
31 |
32 | 33 | name; ?>( count;?> ) 34 | 35 |
36 |
37 | 41 |
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /products-shop.php: -------------------------------------------------------------------------------- 1 | __( 'Default sorting', 'woocommerce' ), 11 | 'popularity' => __( 'Sort by popularity', 'woocommerce' ), 12 | 'rating' => __( 'Sort by average rating', 'woocommerce' ), 13 | 'date' => __( 'Sort by newness', 'woocommerce' ), 14 | 'price' => __( 'Sort by price: low to high', 'woocommerce' ), 15 | 'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ), 16 | ) ); 17 | 18 | $default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) ); 19 | $orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok. 20 | 21 | if ( wc_get_loop_prop( 'is_search' ) ) { 22 | $catalog_orderby_options = array_merge( array( 'relevance' => __( 'Relevance', 'woocommerce' ) ), $catalog_orderby_options ); 23 | 24 | unset( $catalog_orderby_options['menu_order'] ); 25 | } 26 | 27 | if ( ! $show_default_orderby ) { 28 | unset( $catalog_orderby_options['menu_order'] ); 29 | } 30 | 31 | if ( 'no' === get_option( 'woocommerce_enable_review_rating' ) ) { 32 | unset( $catalog_orderby_options['rating'] ); 33 | } 34 | 35 | if ( ! array_key_exists( $orderby, $catalog_orderby_options ) ) { 36 | $orderby = current( array_keys( $catalog_orderby_options ) ); 37 | } 38 | ?> 39 |
40 | $catalog_orderby_options, 43 | 'orderby' => $orderby, 44 | 'show_default_orderby' => $show_default_orderby, 45 | ) ); 46 | ?> 47 |
48 | 'product', 71 | 'meta_key' => $meta_key, 72 | 'orderby' => 'meta_value', 73 | 'order' => $order, 74 | // 'tax_query' => array( 75 | // array( 76 | // 'taxonomy' => 'product_cat', 77 | // 'field' => 'slug', 78 | // 'terms' => 'women', 79 | // ), 80 | // ) 81 | ); 82 | 83 | $result = new WP_Query( $args ); 84 | 85 | 86 | ?> 87 |
88 |
89 | have_posts() ) { 91 | while ( $result->have_posts() ) : $result->the_post(); 92 | $default_img = ''; 93 | $img = ( get_the_post_thumbnail() ) ? get_the_post_thumbnail() : $default_img; 94 | $id = get_the_ID(); 95 | ?> 96 |
97 |
98 |

99 |
100 |
101 | 105 |
106 |
107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /single-product.php: -------------------------------------------------------------------------------- 1 | 11 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 44 | 45 | 46 | --------------------------------------------------------------------------------