tier-pricing-table
/
src
/
Settings
/
Sections
/
GeneralSection
/
Subsections
/
NonLoggedInUsersSubsection.php
NonLoggedInUsersSubsection.php in Tiered Pricing Table for WooCommerce 6.1.0, at src/Settings/Sections/GeneralSection/Subsections/NonLoggedInUsersSubsection.php
| 1 | <?php namespace TierPricingTable\Settings\Sections\GeneralSection\Subsections; |
| 2 | |
| 3 | use TierPricingTable\Settings\CustomOptions\TPTSwitchOption; |
| 4 | use TierPricingTable\Settings\CustomOptions\TPTTextTemplate; |
| 5 | use TierPricingTable\Settings\Sections\SubsectionAbstract; |
| 6 | use TierPricingTable\Settings\Settings; |
| 7 | |
| 8 | class NonLoggedInUsersSubsection extends SubsectionAbstract { |
| 9 | |
| 10 | public function getTitle(): string { |
| 11 | return __( 'Non logged-in users', 'tier-pricing-table' ); |
| 12 | } |
| 13 | |
| 14 | public function getDescription(): string { |
| 15 | return __( 'Control whether to display prices for non-logged in users or not. Allow them to purchase products or not.', |
| 16 | 'tier-pricing-table' ); |
| 17 | } |
| 18 | |
| 19 | public function getSlug(): string { |
| 20 | return 'non-logged-in-users'; |
| 21 | } |
| 22 | |
| 23 | public function getSettings(): array { |
| 24 | return array( |
| 25 | array( |
| 26 | 'title' => __( 'Prevent purchase for non-logged-in users', 'tier-pricing-table' ), |
| 27 | 'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_prevent_purchase', |
| 28 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 29 | 'default' => 'no', |
| 30 | 'desc_tip' => false, |
| 31 | ), |
| 32 | |
| 33 | array( |
| 34 | 'title' => __( 'Add-to-cart button label for non-logged-in users', 'tier-pricing-table' ), |
| 35 | 'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_add_to_cart_label', |
| 36 | 'type' => 'text', |
| 37 | 'default' => '', |
| 38 | 'desc' => __( 'Change default Add to cart label to something else to be displayed for non-logged users.', |
| 39 | 'tier-pricing-table' ), |
| 40 | 'placeholder' => __( 'Leave empty to keep it as it is', 'tier-pricing-table' ), |
| 41 | 'desc_tip' => false, |
| 42 | ), |
| 43 | |
| 44 | array( |
| 45 | 'title' => __( 'Error message when non-logged-in users add to cart', 'tier-pricing-table' ), |
| 46 | 'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_purchase_message', |
| 47 | 'type' => TPTTextTemplate::FIELD_TYPE, |
| 48 | 'placeholders' => array(), |
| 49 | // translators: %s: login page url |
| 50 | 'default' => sprintf( __( 'Please enter %s to make a purchase.', 'tier-pricing-table' ), |
| 51 | sprintf( '<a href="%s">%s</a>', wc_get_account_endpoint_url( 'dashboard' ), |
| 52 | __( 'your account', 'tier-pricing-table' ) ) ), |
| 53 | ), |
| 54 | |
| 55 | array( |
| 56 | 'title' => __( 'Hide prices for non-logged-in users', 'tier-pricing-table' ), |
| 57 | 'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_hide_prices', |
| 58 | 'type' => TPTSwitchOption::FIELD_TYPE, |
| 59 | 'default' => 'no', |
| 60 | 'desc_tip' => false, |
| 61 | ), |
| 62 | array( |
| 63 | 'title' => __( 'Price message for non-logged-in users', 'tier-pricing-table' ), |
| 64 | 'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_price_message', |
| 65 | 'type' => TPTTextTemplate::FIELD_TYPE, |
| 66 | 'description' => __( 'This message will be displayed instead of the price for non-logged-in users.', |
| 67 | 'tier-pricing-table' ), |
| 68 | 'placeholders' => array(), |
| 69 | // translators: %s: login page url |
| 70 | 'default' => sprintf( __( '%s see prices', 'tier-pricing-table' ), |
| 71 | sprintf( '<a href="%s">%s</a>', wc_get_account_endpoint_url( 'dashboard' ), |
| 72 | __( 'Login', 'tier-pricing-table' ) ) ), |
| 73 | ), |
| 74 | ); |
| 75 | } |
| 76 | } |
| 77 |