CustomizeStoreWithBlocks.php
2 years ago
CustomizingProductCatalog.php
1 year ago
EUVATNumber.php
2 years ago
EditProductsOnTheMove.php
2 years ago
EmailImprovements.php
1 year ago
FirstProduct.php
1 year ago
GivingFeedbackNotes.php
3 years ago
InstallJPAndWCSPlugins.php
4 weeks ago
LaunchChecklist.php
2 years ago
MagentoMigration.php
2 years ago
ManageOrdersOnTheGo.php
2 years ago
MarketingJetpack.php
4 weeks ago
MigrateFromShopify.php
2 years ago
MobileApp.php
2 years ago
NewSalesRecord.php
3 years ago
NoteActionForbiddenException.php
4 weeks ago
OnboardingPayments.php
2 years ago
OnlineClothingStore.php
2 years ago
OrderMilestones.php
2 years ago
PaymentsMoreInfoNeeded.php
5 months ago
PaymentsRemindMeLater.php
5 months ago
PerformanceOnMobile.php
2 years ago
PersonalizeStore.php
3 years ago
RealTimeOrderAlerts.php
2 years ago
ScheduledUpdatesPromotion.php
5 months ago
SellingOnlineCourses.php
2 years ago
TrackingOptIn.php
1 year ago
UnsecuredReportFiles.php
2 years ago
WooCommercePayments.php
2 years ago
WooCommerceSubscriptions.php
2 years ago
WooSubscriptionsNotes.php
1 year ago
EUVATNumber.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Admin: EU VAT Number Note. |
| 4 | * |
| 5 | * Adds a note for EU store to install the EU VAT Number extension. |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\WooCommerce\Internal\Admin\Notes; |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | use Automattic\WooCommerce\Admin\Notes\Note; |
| 13 | use Automattic\WooCommerce\Admin\Notes\NoteTraits; |
| 14 | |
| 15 | /** |
| 16 | * EU_VAT_Number |
| 17 | */ |
| 18 | class EUVATNumber { |
| 19 | /** |
| 20 | * Note traits. |
| 21 | */ |
| 22 | use NoteTraits; |
| 23 | |
| 24 | /** |
| 25 | * Name of the note for use in the database. |
| 26 | */ |
| 27 | const NOTE_NAME = 'wc-admin-eu-vat-number'; |
| 28 | |
| 29 | /** |
| 30 | * Get the note. |
| 31 | * |
| 32 | * @return Note |
| 33 | */ |
| 34 | public static function get_note() { |
| 35 | if ( 'yes' !== get_option( 'wc_connect_taxes_enabled', 'no' ) ) { |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | $country_code = WC()->countries->get_base_country(); |
| 40 | $eu_countries = WC()->countries->get_european_union_countries(); |
| 41 | if ( ! in_array( $country_code, $eu_countries, true ) ) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $content = __( "If your store is based in the EU, we recommend using the EU VAT Number extension in addition to automated taxes. It provides your checkout with a field to collect and validate a customer's EU VAT number, if they have one.", 'woocommerce' ); |
| 46 | |
| 47 | $note = new Note(); |
| 48 | $note->set_title( __( 'Collect and validate EU VAT numbers at checkout', 'woocommerce' ) ); |
| 49 | $note->set_content( $content ); |
| 50 | $note->set_content_data( (object) array() ); |
| 51 | $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING ); |
| 52 | $note->set_name( self::NOTE_NAME ); |
| 53 | $note->set_source( 'woocommerce-admin' ); |
| 54 | $note->add_action( |
| 55 | 'learn-more', |
| 56 | __( 'Learn more', 'woocommerce' ), |
| 57 | 'https://woocommerce.com/products/eu-vat-number/?utm_medium=product', |
| 58 | Note::E_WC_ADMIN_NOTE_ACTIONED |
| 59 | ); |
| 60 | return $note; |
| 61 | } |
| 62 | } |
| 63 |