Apparently Woocommerce need a local path and not a URL to the file. In order to fix I used this:
function attach_order_notice ( $attachments, $email_id, $order ) {
// Only for "New Order" email notification (for admin)
//if( $email_id == 'new_order' ){
$file_path = wp_upload_dir()['path'];
$file_name = get_field( 'email_file_attachment', 'options' )['filename'];
$attachments[] = $file_path . "https://wordpress.stackexchange.com/" . $file_name;
//}
return $attachments;
}
add_filter( 'woocommerce_email_attachments', 'attach_order_notice', 10, 3 );
I hope this helps someone.
Related Posts:
- Woocommerce HTML email option unavailable
- Trigger Woocommerce New User Email
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- Set a condition based on WooCommerce checkout city field while placing order
- WooCommerce – Email admin with new user details
- I want to fusion the product columns in email table order
- Woocommerce checkout page – custom field checkbox value into email
- Woocommerce custom field on emails outputs ‘Array’
- Why does WordPress not send the user the email to add a password?
- How to automatically apply woocommerce product title to all product images alt tags?
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- WP_Query | Help me create a search term with an ‘OR’ relation?
- WooCommerce – Customer Order History Pagination
- Replace existing content from specific WooCommerce admin orders list column
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Send PDF link in email based on radio button selection
- Woocommerce filter cart and category specific quantity [closed]
- How to get woocommerce cart content without an action?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- Woocommerce product download URL
- Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]
- Limiting woocommerce line_total decimal length
- How can I use wp_query to show all product data using just the products ID?
- write custom woocommerce templates and forms
- Get stock by custom meta field on all Woocommerce variable products
- Call global variable array() in woocommerce child/template
- Remove price from Woocommerce variable product dropdown menu
- How do you ensure that a user is recognised and available for use only when it is verified through a row in the database called ‘accountVerified’?
- Issue adding sub category programmatically
- PHP 8, AJAX mail form to function.php doesn’t work
- Get and insert order email address to the PHP template inside HTML text
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- If no products are on sale – hide ID or class
- do search in two site and show the result in first site
- Send multiple attachments with wp_mail in PHP
- How can I pass a custom/dynamic product to the Woocommerce cart?
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- How to get private property in parent class into extended class?
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- Add post with approval by the admin
- Woocommerce display one random product via php
- Change product_base programmatically
- How to optimize update_post_meta?
- Add product to cart for user – WC()->cart->add_to_cart [closed]
- customize woocommerce templates and display store on home
- WC_Customer delete function returns error
- Display attribute on shop page after the title
- CSS change in woo commerce Place Order Text [closed]
- Get user custom field value on function.php
- WooCommerce – Moving Product Price to the Left of Add to Cart Button [closed]
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- Woocommerce: remove total sum from new order’s email [closed]
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- Alter Woocommerce product archive structure
- custom post type with role Vendor
- WooCommerce: Display product categories to make IF statement
- Modify WooCommerce used to get all orders in dashboard
- Replace category title with category description in woocommerce
- Add Custom Category Description When Empty
- I am having issue in divi woocomerce checkout module. (DIVI theme)
- Add a product category to a specific product via a button
- WooCommerce Query Product Titles
- Woocommerce display orders with products from specific categories to specific admins
- Display div if category has a specific parent
- global $product is empty string when passed into function
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- Use PHP Class in WordPress functions
- Use Search Term in html link and redirect
- Don’t update modified post date when user add a product review or comment?
- How do I change the “login” label in My Account page to “Registered Customer”
- Customize the “Available for back order” text for specific variation
- How to remove the replace the product image by video on shop page conditionally
- get_filtered_term_product_counts – Get product terms if any products
- How to import woocommerce custom fields data into another site?
- How to add custom attribute to all outofstock and all instock products automatically?
- Site infected by link
- Woocommerce – if selected attribute term equals
- split 1 cart item into instock and back ordered
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Add Product Permalink in woocommerce admin order page
- sessionStorage saves input value in browser but it is not loaded in the form field
- Send email to users when they get new followers
- WooCommerce – Add Shipping class below each product in Shopping Cart page
- Hide price excluding tax when price is empty
- WooCommerce Custom Tab with ACF Repeater Field
- Display product attributes for current product
- How to remove image on single product and get product to span page?
- Trying send mail from Theme page
- Adding placeholder text field to woocommerce checkout [closed]
- Getting custom field data from cart page to checkout page in woocomerce [closed]
- Send a custom notification to customer on WooCommerce cancelled order status
- How to code bulk order form in wordpress
- Custom field fetch error on woocommerce pdf invoice
- posts_clauses drop ACF get_field function
- WCFM Custom form
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Find owner of coupon
- Removing the add to cart button from specific product pages