get_id(); $is_wishlist_enabled = Botiga_Modules::is_module_active( 'wishlist' ); $wishlist_layout = get_theme_mod( 'shop_product_wishlist_layout', 'layout1' ); if ( ! $is_wishlist_enabled || $is_wishlist_enabled && 'layout1' === $wishlist_layout ) { return ''; } $shop_product_wishlist_tooltip = get_theme_mod( 'shop_product_wishlist_tooltip', 0 ); $tooltip_text = $shop_product_wishlist_tooltip ? get_theme_mod( 'shop_product_wishlist_tooltip_text' ) : ''; $wishlist_page_link = get_the_permalink( get_option( 'botiga_wishlist_page_id' ) ); if( $do_echo === false ) { ob_start(); } ?> get_id(); $wishlist_layout = get_theme_mod( 'shop_product_wishlist_layout', 'layout1' ); if( 'layout1' === $wishlist_layout ) { return ''; } $wishlist_page_link = get_the_permalink( get_option( 'botiga_wishlist_page_id' ) ); $product_is_inthe_wishlist = botiga_product_is_inthe_wishlist( $product_id ); $button_text = $product_is_inthe_wishlist ? __( 'View Wishlist', 'botiga' ) : __( 'Add to Wishlist', 'botiga' ); if( $do_echo === false ) { ob_start(); } ?>
'success', 'qty' => absint( $qty ), ) ); } add_action('wp_ajax_botiga_button_wishlist', 'botiga_button_wishlist_callback_function'); add_action( 'wp_ajax_nopriv_botiga_button_wishlist', 'botiga_button_wishlist_callback_function' ); /** * Wishlist - Check if the product is in the list */ function botiga_product_is_inthe_wishlist( $product_id ) { if( ! isset( $_COOKIE['woocommerce_items_in_cart_botiga_wishlist'] ) ) { return false; } $wishlist_products = sanitize_text_field( wp_unslash( $_COOKIE['woocommerce_items_in_cart_botiga_wishlist'] ) ); $products = explode( ',', $wishlist_products ); if( in_array( $product_id, $products ) ) { return true; } return false; }