$value ) { if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { $merged[ $key ] = merchant_supply_defaults( $merged[ $key ], $value ); } else { $merged[ $key ] = $value; } } return $merged; } } if ( ! function_exists( 'merchant_admin_upgrade_link' ) ) { /** * Get the Merchant Pro upgrade link. * * @param string $url The base URL for the upgrade link. * @param array $args The arguments for the upgrade link. (Key-value pairs) * @param string $type The type of upgrade link. * * @return string The upgrade link. */ function merchant_admin_upgrade_link( $url, $args = array(), $type = 'plugins-page-upgrade-link' ) { if ( ! empty( $args ) ) { $url = add_query_arg( $args, $url ); } /** * Modify upgrade link. * * @param string $url The upgrade link URL. * @param string $type The type of upgrade link. * * @since 2.1.5 * */ return apply_filters( 'merchant_upgrade_link', $url, $type ); } } if ( ! function_exists( 'merchant_pro_is_active' ) ) { /** * Check if Merchant Pro is active. * * @return bool */ function merchant_pro_is_active() { return defined( 'MERCHANT_PRO_VERSION' ); } } if ( ! function_exists( 'merchant_pro_license_exists' ) ) { /** * Check if Merchant Pro license exists. * * @return bool */ function merchant_pro_license_exists() { return ! empty( get_option( 'merchant_pro_license_key' ) ); } } /** * Check if any shortcode starts with merchant doesn't exist. * If the shortcode is not registered, register it with return null to guarantee it exists. */ if ( ! function_exists( 'merchant_modules_shortcode_exists' ) ) { function merchant_modules_shortcode_exists() { /** * Filter the shortcodes. * * @param array $shortcodes modules shortcodes * * @since 1.8 */ $shortcodes = apply_filters( 'merchant_modules_shortcodes', array( 'merchant_module_stock_scarcity', 'merchant_module_wait_list', 'merchant_module_volume_discounts', 'merchant_module_payment_logos', 'merchant_module_cart_reserved_timer', 'merchant_module_product_brand_image', 'merchant_module_size_chart', 'merchant_module_reasons_to_buy', 'merchant_module_recently_viewed_products', 'merchant_module_trust_badges', 'merchant_module_advanced_reviews', 'merchant_module_frequently_bought_together', 'merchant_module_buy_x_get_y', 'merchant_module_product_bundles', 'merchant_module_quick_social_links', 'merchant_module_product_navigation_links', 'merchant_module_product_video', 'merchant_module_product_audio', 'merchant_module_countdown_timer', 'merchant_module_product_labels', 'merchant_module_wishlist', 'merchant_module_clear_cart', 'merchant_module_free_shipping_progress_bar_single_product_page', 'merchant_module_free_shipping_progress_bar_cart_page', 'merchant_module_free_shipping_progress_bar_checkout_page', 'merchant_module_quick_view', 'merchant_module_real_time_search', 'merchant_reviews_carousel', 'merchant_module_complementary_products', ) ); // Loop through the shortcodes and register them if they don't exist. array_map( static function ( $shortcode ) { if ( ! shortcode_exists( $shortcode ) ) { add_shortcode( $shortcode, '__return_null' ); } }, $shortcodes ); } } add_action( 'init', 'merchant_modules_shortcode_exists' );