feat: implement header/footer visibility controls for checkout and thankyou pages

- Created LayoutWrapper component to conditionally render header/footer based on route
- Created MinimalHeader component (logo only)
- Created MinimalFooter component (trust badges + policy links)
- Created usePageVisibility hook to get visibility settings per page
- Wrapped ClassicLayout with LayoutWrapper for conditional rendering
- Header/footer visibility now controlled directly in React SPA
- Settings: show/minimal/hide for both header and footer
- Background color support for checkout and thankyou pages
This commit is contained in:
Dwindi Ramadhana
2025-12-25 22:20:48 +07:00
parent c37ecb8e96
commit 9ac09582d2
104 changed files with 14801 additions and 1213 deletions

View File

@@ -100,6 +100,8 @@ class ShopController {
$orderby = $request->get_param('orderby');
$order = $request->get_param('order');
$slug = $request->get_param('slug');
$include = $request->get_param('include');
$exclude = $request->get_param('exclude');
$args = [
'post_type' => 'product',
@@ -115,12 +117,27 @@ class ShopController {
$args['name'] = $slug;
}
// Add include filter (specific product IDs)
if (!empty($include)) {
$ids = array_map('intval', explode(',', $include));
$args['post__in'] = $ids;
$args['orderby'] = 'post__in'; // Maintain order of IDs
}
// Add exclude filter (exclude specific product IDs)
if (!empty($exclude)) {
$ids = array_map('intval', explode(',', $exclude));
$args['post__not_in'] = $ids;
}
// Add category filter
if (!empty($category)) {
// Check if category is numeric (ID) or string (slug)
$field = is_numeric($category) ? 'term_id' : 'slug';
$args['tax_query'] = [
[
'taxonomy' => 'product_cat',
'field' => 'slug',
'field' => $field,
'terms' => $category,
],
];
@@ -251,6 +268,9 @@ class ShopController {
'type' => $product->get_type(),
'image' => wp_get_attachment_url($product->get_image_id()),
'permalink' => get_permalink($product->get_id()),
'categories' => wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'all']),
'virtual' => $product->is_virtual(),
'downloadable' => $product->is_downloadable(),
];
// Add detailed info if requested
@@ -258,7 +278,6 @@ class ShopController {
$data['description'] = $product->get_description();
$data['short_description'] = $product->get_short_description();
$data['sku'] = $product->get_sku();
$data['categories'] = wp_get_post_terms($product->get_id(), 'product_cat', ['fields' => 'all']);
$data['tags'] = wp_get_post_terms($product->get_id(), 'product_tag', ['fields' => 'names']);
// Gallery images
@@ -329,9 +348,25 @@ class ShopController {
$variation_obj = wc_get_product($variation['variation_id']);
if ($variation_obj) {
// Get attributes directly from post meta (most reliable)
$attributes = [];
$variation_id = $variation['variation_id'];
// Query all post meta for this variation
global $wpdb;
$meta_rows = $wpdb->get_results($wpdb->prepare(
"SELECT meta_key, meta_value FROM {$wpdb->postmeta}
WHERE post_id = %d AND meta_key LIKE 'attribute_%%'",
$variation_id
));
foreach ($meta_rows as $row) {
$attributes[$row->meta_key] = $row->meta_value;
}
$variations[] = [
'id' => $variation['variation_id'],
'attributes' => $variation['attributes'],
'id' => $variation_id,
'attributes' => $attributes,
'price' => $variation_obj->get_price(),
'regular_price' => $variation_obj->get_regular_price(),
'sale_price' => $variation_obj->get_sale_price(),