| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | use FluentCart\App\Helpers\Helper; |
| 11 | 11 | //use FluentCart\App\Hooks\Handlers\ShortCodes\Buttons\AddToCartShortcode; |
| 12 | 12 | use FluentCart\App\Models\ProductDetail; |
| 13 | 13 | use FluentCart\App\Modules\Templating\AssetLoader; |
| 14 | +use FluentCart\App\Services\Renderer\RenderContext; | |
| 14 | 15 | use FluentCart\App\Services\Renderer\ShopAppRenderer; |
| 15 | 16 | use FluentCart\App\Services\TemplateService; |
| 16 | 17 | use FluentCart\App\Vite; |
| 17 | 18 | use FluentCart\Framework\Support\Arr; |
| @@ -44,9 +45,17 @@ | ||
| 44 | 45 | $this->enqueueStyles(); |
| 45 | 46 | } |
| 46 | 47 | }, 5); |
| 47 | 48 | add_shortcode(static::SHORT_CODE, function ($shortcodeAttributes, $content, $block) { |
| 48 | - return $this->handelShortcodeCall($shortcodeAttributes); | |
| 49 | + // The shop shortcode registers its own closure rather than going | |
| 50 | + // through ShortCode::register(), so it declares itself separately. | |
| 51 | + return RenderContext::declaring( | |
| 52 | + RenderContext::SOURCE_SHORTCODE, | |
| 53 | + static::SHORT_CODE, | |
| 54 | + function () use ($shortcodeAttributes) { | |
| 55 | + return $this->handelShortcodeCall($shortcodeAttributes); | |
| 56 | + } | |
| 57 | + ); | |
| 49 | 58 | }); |
| 50 | 59 | } |
| 51 | 60 | |
| 52 | 61 | public function handelShortcodeCall($shortcodeAttributes) |