Created
November 25, 2020 06:53
-
-
Save yousufansa/c8ad3fecdb0916b8252e62dee4490be8 to your computer and use it in GitHub Desktop.
Cartzilla Marketplace - Fix for Error on Products page with Vendor Subscription Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ( ! function_exists( 'cartzilla_dokan_show_custom_subscription_info' ) ) { | |
| function cartzilla_dokan_show_custom_subscription_info() { | |
| $vendor_id = dokan_get_current_user_id(); | |
| if ( dokan_is_seller_enabled( $vendor_id ) ) { | |
| $remaining_product = \DokanPro\Modules\Subscription\Helper::get_vendor_remaining_products( $vendor_id ); | |
| if ( '-1' === $remaining_product ) { | |
| return printf( '<p class="dokan-info">%s</p>', esc_html__( 'You can add unlimited products', 'cartzilla' ) ); | |
| } | |
| if ( $remaining_product == 0 || ! ( get_user_meta( dokan_get_current_user_id(), 'can_post_product', true ) == '1' ) ) { | |
| if( defined('DOKAN_PLUGIN_VERSION') ) { | |
| $permalink = dokan_get_navigation_url( 'subscription' ); | |
| } else { | |
| $page_id = dokan_get_option( 'subscription_pack', 'dokan_product_subscription' ); | |
| $permalink = get_permalink( $page_id ); | |
| } | |
| $info = sprintf( __( 'Sorry! You can not add or publish any more product. Please <a href="%s">update your package</a>.', 'cartzilla' ), $permalink ); | |
| echo "<p class='dokan-info'>" . wp_kses_post( $info ) . "</p>"; | |
| echo "<style>.dokan-add-product-link{display : none !important}</style>"; | |
| } else { | |
| echo "<p class='dokan-info'>" . wp_kses_post( sprintf( esc_html__( 'You can add %d more product(s).', 'cartzilla' ), $remaining_product ) ) . "</p>"; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment