Changeset 3831643
- Timestamp:
- 11/28/2026 02:54:27 PM (less than one hour ago)
- Location:
- nitroweb-amazing-wishlist-for-woocommerce
- Files:
-
- 2 added
- 16 edited
- 1 copied
-
assets/banner-1544x500.png (modified) ( previous)
-
assets/banner-772x250.png (modified) ( previous)
-
tags/1.7.4 (copied) (copied from nitroweb-amazing-wishlist-for-woocommerce/trunk )
-
tags/1.7.4/assets/css/nawfw-frontend.css (modified) (1 diff)
-
tags/1.7.4/assets/js/nawfw-blocks.js (modified) (2 diffs)
-
tags/1.7.4/includes/class-nawfw-block-placement.php (added)
-
tags/1.7.4/includes/class-nawfw-blocks.php (modified) (3 diffs)
-
tags/1.7.4/includes/class-nawfw-plugin.php (modified) (2 diffs)
-
tags/1.7.4/includes/class-nawfw-shortcodes.php (modified) (2 diffs)
-
tags/1.7.4/nitroweb-amazing-wishlist-for-woocommerce.php (modified) (2 diffs)
-
tags/1.7.4/readme.txt (modified) (4 diffs)
-
trunk/assets/css/nawfw-frontend.css (modified) (1 diff)
-
trunk/assets/js/nawfw-blocks.js (modified) (2 diffs)
-
trunk/includes/class-nawfw-block-placement.php (added)
-
trunk/includes/class-nawfw-blocks.php (modified) (3 diffs)
-
trunk/includes/class-nawfw-plugin.php (modified) (2 diffs)
-
trunk/includes/class-nawfw-shortcodes.php (modified) (2 diffs)
-
trunk/nitroweb-amazing-wishlist-for-woocommerce.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/assets/css/nawfw-frontend.css
r3829857 r3831643 110 110 } 111 111 112 /* Product pages without an Add to Cart button (out of stock, not purchasable). */ 113 .nawfw-product-page-button { 114 margin: 0 0 1em; 115 } 116 117 .nawfw-product-page-button .nawfw-add-button, 118 .nawfw-block-loop-button .nawfw-add-button { 119 margin-left: 0; 120 } 121 122 /* Product Collection blocks (related products, grids on pages). */ 123 .nawfw-block-loop-button { 124 margin-top: 8px; 125 } 126 127 .wc-block-components-product-image:has(> .nawfw-on-image-wrap) { 128 position: relative; 129 } 130 112 131 /* -------------------------------------------------------------------------- 113 132 "Icon Only in Loop" -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/assets/js/nawfw-blocks.js
r3829857 r3831643 42 42 variationId: { type: 'number', default: 0 } 43 43 }, 44 usesContext: [ 'postId', 'postType' ], 44 45 edit: function ( props ) { 45 46 var attributes = props.attributes; … … 75 76 el( ServerSideRender, { 76 77 block: 'nawfw/add-to-wishlist-button', 77 attributes: attributes 78 attributes: attributes, 79 // Product of the block context (e.g. a product card in a Product Collection). 80 urlQueryArgs: props.context && props.context.postId ? { post_id: props.context.postId } : {} 78 81 } ) 79 82 ); -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/includes/class-nawfw-blocks.php
r3829857 r3831643 50 50 ), 51 51 ), 52 'uses_context' => array( 'postId', 'postType' ), 52 53 'render_callback' => array( __CLASS__, 'render_button_block' ), 53 54 ) … … 83 84 * Render button block. 84 85 * 85 * @param array $attributes Attributes. 86 * The product is the one set in the block settings, else the product of the 87 * block context (product card in a Product Collection, product template), 88 * else the current post. 89 * 90 * @param array $attributes Attributes. 91 * @param string $content Inner content (unused). 92 * @param WP_Block|null $block Block instance. 86 93 * @return string 87 94 */ 88 public static function render_button_block( array $attributes = array() ): string { 89 $product_id = ! empty( $attributes['productId'] ) ? (int) $attributes['productId'] : (int) get_the_ID(); 95 public static function render_button_block( array $attributes = array(), $content = '', $block = null ): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Block render callback signature. 90 96 $variation_id = ! empty( $attributes['variationId'] ) ? (int) $attributes['variationId'] : 0; 97 $product_id = ! empty( $attributes['productId'] ) ? (int) $attributes['productId'] : 0; 98 99 if ( ! $product_id && $block instanceof WP_Block && ! empty( $block->context['postId'] ) ) { 100 $product_id = (int) $block->context['postId']; 101 } 102 if ( ! $product_id ) { 103 $product_id = (int) get_the_ID(); 104 } 105 if ( $product_id && 'product' !== get_post_type( $product_id ) && 'product_variation' !== get_post_type( $product_id ) ) { 106 $product_id = 0; 107 } 108 109 // Block editor preview without a product (e.g. a template in the Site Editor): 110 // show the button of a sample product, so it can be seen and styled. 111 if ( ! $product_id && self::is_editor_preview() ) { 112 $sample = wc_get_products( 113 array( 114 'status' => 'publish', 115 'limit' => 1, 116 'return' => 'ids', 117 ) 118 ); 119 $product_id = $sample ? (int) $sample[0] : 0; 120 } 91 121 92 122 if ( ! $product_id ) { … … 96 126 return NAWFW_Shortcodes::render_button( $product_id, $variation_id ); 97 127 } 128 129 /** 130 * Whether the block is being rendered for the block editor preview. 131 */ 132 private static function is_editor_preview(): bool { 133 return defined( 'REST_REQUEST' ) && REST_REQUEST && current_user_can( 'edit_posts' ) && function_exists( 'wc_get_products' ); 134 } 98 135 } -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/includes/class-nawfw-plugin.php
r3829857 r3831643 78 78 require_once NAWFW_PATH . 'includes/class-nawfw-wpml.php'; 79 79 require_once NAWFW_PATH . 'includes/class-nawfw-blocks.php'; 80 require_once NAWFW_PATH . 'includes/class-nawfw-block-placement.php'; 80 81 require_once NAWFW_PATH . 'includes/class-nawfw-elementor.php'; 81 82 require_once NAWFW_PATH . 'includes/class-nawfw-nav-menu.php'; … … 100 101 NAWFW_WPML::init(); 101 102 NAWFW_Blocks::init(); 103 NAWFW_Block_Placement::init(); 102 104 NAWFW_Elementor::init(); 103 105 NAWFW_Nav_Menu::init(); -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/includes/class-nawfw-shortcodes.php
r3829857 r3831643 218 218 $variation_id = $product->is_type( 'variation' ) ? $product_id : 0; 219 219 220 NAWFW_Block_Placement::mark_product_page_button( $product_id ); 221 if ( $product->get_parent_id() ) { 222 NAWFW_Block_Placement::mark_product_page_button( $product->get_parent_id() ); 223 } 224 220 225 echo wp_kses( self::render_button( $product_id, $variation_id ), nawfw_allowed_wishlist_html() ); 221 226 } … … 242 247 } 243 248 echo '<span class="nawfw-on-image-wrap">' . wp_kses( self::apply_loop_icon_only_class( self::render_button( $product->get_id(), 0 ) ), nawfw_allowed_wishlist_html() ) . '</span>'; 249 } 250 251 /** 252 * Loop (product card) button markup for a product, with the icon-only class applied. 253 * 254 * @param int $product_id Product ID. 255 */ 256 public static function loop_button_html( int $product_id ): string { 257 return self::apply_loop_icon_only_class( self::render_button( $product_id, 0 ) ); 244 258 } 245 259 -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/nitroweb-amazing-wishlist-for-woocommerce.php
r3829857 r3831643 3 3 * Plugin Name: Nitroweb Amazing Wishlist for WooCommerce 4 4 * Description: Wishlist plugin for WooCommerce with guest support, AJAX interactions, sharing, price-drop and back-in-stock alerts, and WPML support. 5 * Version: 1.7. 35 * Version: 1.7.4 6 6 * Author: Nitroweb 7 7 * Author URI: https://nitroweb.gr/ … … 38 38 define( 'NAWFW_LOADED', __FILE__ ); 39 39 40 define( 'NAWFW_VERSION', '1.7. 3' );40 define( 'NAWFW_VERSION', '1.7.4' ); 41 41 define( 'NAWFW_FILE', __FILE__ ); 42 42 define( 'NAWFW_PATH', plugin_dir_path( __FILE__ ) ); -
nitroweb-amazing-wishlist-for-woocommerce/tags/1.7.4/readme.txt
r3829857 r3831643 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.7. 37 Stable tag: 1.7.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 19 19 [Free plugin documentation](https://amazingwpplugins.com/documentation/nitroweb-amazing-wishlist-for-woocommerce-free-plugin-documentation/) covers setup, shortcodes, sharing, alerts, and troubleshooting. 20 20 21 https://youtu.be/okFDvATpMJ4 22 21 23 = Core Wishlist Features = 22 24 23 25 * **Add to Wishlist** button on single product pages and shop/archive loops 26 * Works with block themes: the button is added automatically to Product Collection blocks too (related products, product grids on any page), and to product pages without an Add to Cart button (out of stock or not purchasable) 24 27 * Configurable button position: after Add to Cart, overlaid on the product image, icon-only, or fully manual placement 25 28 * Customizable button text, icon (heart, bookmark, star, or none), and colours (text, border, background — including hover states) … … 119 122 == Changelog == 120 123 124 = 1.7.4 — 27 Nov 2026 = 125 * New: The button appears on product pages without an Add to Cart button (out of stock or not purchasable), with classic and block-based product templates. 126 * New: Product Collection blocks outside the shop templates (related products on block-based product pages, product grids on any page) get the button automatically, following the "Show on Loop" and "Loop Button Position" settings. Cards where the Add to Wishlist Button block was placed by hand are left as they are. 127 * New: The Add to Wishlist Button block picks up the product from its block context (for example a product card in a Product Collection), and the editor preview shows the button even in templates without a product. 128 121 129 = 1.7.3 = 122 130 * Escape wishlist buttons, icons, product images, and prices when rendering. … … 159 167 == Upgrade Notice == 160 168 169 = 1.7.4 = 170 Adds the button to out-of-stock product pages and to Product Collection blocks (related products, product grids). 171 161 172 = 1.7.3 = 162 173 Updates wishlist output escaping and uses WordPress.org language packs. -
nitroweb-amazing-wishlist-for-woocommerce/trunk/assets/css/nawfw-frontend.css
r3829857 r3831643 110 110 } 111 111 112 /* Product pages without an Add to Cart button (out of stock, not purchasable). */ 113 .nawfw-product-page-button { 114 margin: 0 0 1em; 115 } 116 117 .nawfw-product-page-button .nawfw-add-button, 118 .nawfw-block-loop-button .nawfw-add-button { 119 margin-left: 0; 120 } 121 122 /* Product Collection blocks (related products, grids on pages). */ 123 .nawfw-block-loop-button { 124 margin-top: 8px; 125 } 126 127 .wc-block-components-product-image:has(> .nawfw-on-image-wrap) { 128 position: relative; 129 } 130 112 131 /* -------------------------------------------------------------------------- 113 132 "Icon Only in Loop" -
nitroweb-amazing-wishlist-for-woocommerce/trunk/assets/js/nawfw-blocks.js
r3829857 r3831643 42 42 variationId: { type: 'number', default: 0 } 43 43 }, 44 usesContext: [ 'postId', 'postType' ], 44 45 edit: function ( props ) { 45 46 var attributes = props.attributes; … … 75 76 el( ServerSideRender, { 76 77 block: 'nawfw/add-to-wishlist-button', 77 attributes: attributes 78 attributes: attributes, 79 // Product of the block context (e.g. a product card in a Product Collection). 80 urlQueryArgs: props.context && props.context.postId ? { post_id: props.context.postId } : {} 78 81 } ) 79 82 ); -
nitroweb-amazing-wishlist-for-woocommerce/trunk/includes/class-nawfw-blocks.php
r3829857 r3831643 50 50 ), 51 51 ), 52 'uses_context' => array( 'postId', 'postType' ), 52 53 'render_callback' => array( __CLASS__, 'render_button_block' ), 53 54 ) … … 83 84 * Render button block. 84 85 * 85 * @param array $attributes Attributes. 86 * The product is the one set in the block settings, else the product of the 87 * block context (product card in a Product Collection, product template), 88 * else the current post. 89 * 90 * @param array $attributes Attributes. 91 * @param string $content Inner content (unused). 92 * @param WP_Block|null $block Block instance. 86 93 * @return string 87 94 */ 88 public static function render_button_block( array $attributes = array() ): string { 89 $product_id = ! empty( $attributes['productId'] ) ? (int) $attributes['productId'] : (int) get_the_ID(); 95 public static function render_button_block( array $attributes = array(), $content = '', $block = null ): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Block render callback signature. 90 96 $variation_id = ! empty( $attributes['variationId'] ) ? (int) $attributes['variationId'] : 0; 97 $product_id = ! empty( $attributes['productId'] ) ? (int) $attributes['productId'] : 0; 98 99 if ( ! $product_id && $block instanceof WP_Block && ! empty( $block->context['postId'] ) ) { 100 $product_id = (int) $block->context['postId']; 101 } 102 if ( ! $product_id ) { 103 $product_id = (int) get_the_ID(); 104 } 105 if ( $product_id && 'product' !== get_post_type( $product_id ) && 'product_variation' !== get_post_type( $product_id ) ) { 106 $product_id = 0; 107 } 108 109 // Block editor preview without a product (e.g. a template in the Site Editor): 110 // show the button of a sample product, so it can be seen and styled. 111 if ( ! $product_id && self::is_editor_preview() ) { 112 $sample = wc_get_products( 113 array( 114 'status' => 'publish', 115 'limit' => 1, 116 'return' => 'ids', 117 ) 118 ); 119 $product_id = $sample ? (int) $sample[0] : 0; 120 } 91 121 92 122 if ( ! $product_id ) { … … 96 126 return NAWFW_Shortcodes::render_button( $product_id, $variation_id ); 97 127 } 128 129 /** 130 * Whether the block is being rendered for the block editor preview. 131 */ 132 private static function is_editor_preview(): bool { 133 return defined( 'REST_REQUEST' ) && REST_REQUEST && current_user_can( 'edit_posts' ) && function_exists( 'wc_get_products' ); 134 } 98 135 } -
nitroweb-amazing-wishlist-for-woocommerce/trunk/includes/class-nawfw-plugin.php
r3829857 r3831643 78 78 require_once NAWFW_PATH . 'includes/class-nawfw-wpml.php'; 79 79 require_once NAWFW_PATH . 'includes/class-nawfw-blocks.php'; 80 require_once NAWFW_PATH . 'includes/class-nawfw-block-placement.php'; 80 81 require_once NAWFW_PATH . 'includes/class-nawfw-elementor.php'; 81 82 require_once NAWFW_PATH . 'includes/class-nawfw-nav-menu.php'; … … 100 101 NAWFW_WPML::init(); 101 102 NAWFW_Blocks::init(); 103 NAWFW_Block_Placement::init(); 102 104 NAWFW_Elementor::init(); 103 105 NAWFW_Nav_Menu::init(); -
nitroweb-amazing-wishlist-for-woocommerce/trunk/includes/class-nawfw-shortcodes.php
r3829857 r3831643 218 218 $variation_id = $product->is_type( 'variation' ) ? $product_id : 0; 219 219 220 NAWFW_Block_Placement::mark_product_page_button( $product_id ); 221 if ( $product->get_parent_id() ) { 222 NAWFW_Block_Placement::mark_product_page_button( $product->get_parent_id() ); 223 } 224 220 225 echo wp_kses( self::render_button( $product_id, $variation_id ), nawfw_allowed_wishlist_html() ); 221 226 } … … 242 247 } 243 248 echo '<span class="nawfw-on-image-wrap">' . wp_kses( self::apply_loop_icon_only_class( self::render_button( $product->get_id(), 0 ) ), nawfw_allowed_wishlist_html() ) . '</span>'; 249 } 250 251 /** 252 * Loop (product card) button markup for a product, with the icon-only class applied. 253 * 254 * @param int $product_id Product ID. 255 */ 256 public static function loop_button_html( int $product_id ): string { 257 return self::apply_loop_icon_only_class( self::render_button( $product_id, 0 ) ); 244 258 } 245 259 -
nitroweb-amazing-wishlist-for-woocommerce/trunk/nitroweb-amazing-wishlist-for-woocommerce.php
r3829857 r3831643 3 3 * Plugin Name: Nitroweb Amazing Wishlist for WooCommerce 4 4 * Description: Wishlist plugin for WooCommerce with guest support, AJAX interactions, sharing, price-drop and back-in-stock alerts, and WPML support. 5 * Version: 1.7. 35 * Version: 1.7.4 6 6 * Author: Nitroweb 7 7 * Author URI: https://nitroweb.gr/ … … 38 38 define( 'NAWFW_LOADED', __FILE__ ); 39 39 40 define( 'NAWFW_VERSION', '1.7. 3' );40 define( 'NAWFW_VERSION', '1.7.4' ); 41 41 define( 'NAWFW_FILE', __FILE__ ); 42 42 define( 'NAWFW_PATH', plugin_dir_path( __FILE__ ) ); -
nitroweb-amazing-wishlist-for-woocommerce/trunk/readme.txt
r3829857 r3831643 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.7. 37 Stable tag: 1.7.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 19 19 [Free plugin documentation](https://amazingwpplugins.com/documentation/nitroweb-amazing-wishlist-for-woocommerce-free-plugin-documentation/) covers setup, shortcodes, sharing, alerts, and troubleshooting. 20 20 21 https://youtu.be/okFDvATpMJ4 22 21 23 = Core Wishlist Features = 22 24 23 25 * **Add to Wishlist** button on single product pages and shop/archive loops 26 * Works with block themes: the button is added automatically to Product Collection blocks too (related products, product grids on any page), and to product pages without an Add to Cart button (out of stock or not purchasable) 24 27 * Configurable button position: after Add to Cart, overlaid on the product image, icon-only, or fully manual placement 25 28 * Customizable button text, icon (heart, bookmark, star, or none), and colours (text, border, background — including hover states) … … 119 122 == Changelog == 120 123 124 = 1.7.4 — 27 Nov 2026 = 125 * New: The button appears on product pages without an Add to Cart button (out of stock or not purchasable), with classic and block-based product templates. 126 * New: Product Collection blocks outside the shop templates (related products on block-based product pages, product grids on any page) get the button automatically, following the "Show on Loop" and "Loop Button Position" settings. Cards where the Add to Wishlist Button block was placed by hand are left as they are. 127 * New: The Add to Wishlist Button block picks up the product from its block context (for example a product card in a Product Collection), and the editor preview shows the button even in templates without a product. 128 121 129 = 1.7.3 = 122 130 * Escape wishlist buttons, icons, product images, and prices when rendering. … … 159 167 == Upgrade Notice == 160 168 169 = 1.7.4 = 170 Adds the button to out-of-stock product pages and to Product Collection blocks (related products, product grids). 171 161 172 = 1.7.3 = 162 173 Updates wishlist output escaping and uses WordPress.org language packs.
Note:
See TracChangeset
for help on using the changeset viewer.