(WordPress/WooCommerce) Add custom product field and download link to be used manually via PHP

Cancelado Publicado hace 7 años Pagado a la entrega
Cancelado Pagado a la entrega

Hello,

I have a WordPress website that runs WooCommerce and sells shipping labels.

Each shipping label is unique. Every time the customer wishes to buy a label, a new product is generated in WooCommerce via PHP. The item is marked as 'virtual' and 'downloadable', so that the user can download their file (shipping label) once the purchase is made. I'm able to generate new items without any problems, however I'm having trouble passing the shipment information through.

I need to be able to pass an extra variable, called "shipment_id", that gets created at the same time as the item gets generated during shopping. The variable needs to get attached to the item. I need to retrieve that variable once payment is confirmed on the "Order Received / Thank You" page , so that I can use some PHP code to retrieve the appropriate label for each item.

Once the label is retrieved, I need to be able to update the download link for each item.

------------------------------

Short Description:

1. Show examples on how to add and retrieve a custom WooCommerce product field via PHP (let's call it shipment_id).

2. Create code to be able to set and retrieve a WooCommerce product download link

These are probably the templates that you'll need to modify:

[url removed, login to view]

[url removed, login to view]

[url removed, login to view]

(probably others?)

Here's the sample code that creates a unique item via PHP:

$my_post = array(

'post_title' => 'USPS Priority Mail or Fedex or something',

'post_content' => 'Description of the item goes here',

'post_status' => 'publish',

'post_author' => 1,

'post_type' =>'product'

);

// Insert the post into the database

$product_ID = wp_insert_post( $my_post );

if ( $product_ID ){

// Basic product info

add_post_meta($product_ID, '_regular_price', $rate->rate );

add_post_meta($product_ID, '_price', $rate->rate );

add_post_meta($product_ID, '_stock_status', 'instock' );

// Only allow one copy of each unique shipping label per cart

add_post_meta($product_ID, '_sold_individually', 'yes' );

// Make product downloadable

add_post_meta($product_ID, '_virtual', 'yes' );

add_post_meta($product_ID, '_downloadable', 'yes' );

// Set temporary product download url

(Your code goes here)

I've tried this code but it doesn't seem to work:

add_post_meta($product_ID, '_wc_file_names', 'Download Link' );

add_post_meta($product_ID, '_wc_file_urls[]', '[url removed, login to view]' );

add_post_meta($product_ID, '_download_expiry', 7 );

I'm looking for someone who can complete this project within the next 24 hours. Full payment upon completion and code tested and verified. Add "Postage123" in the beginning of your bid to let me know you've read the project, understand it, and can complete it.

PHP WordPress

Nº del proyecto: #10841353

Sobre el proyecto

18 propuestas Proyecto remoto Activo hace 7 años

18 freelancers están ofertando un promedio de $58 por este trabajo

toinnisfree

I have read your project details, and I am interested in offering my services. I provide 100% satisfaction guaranteed on all my work. Milestone is required to begin; to be released when the job has been satisfactor Más

$75 USD en 1 día
(749 comentarios)
8.3
evgendob

Hello. Wordpress dev expert ready to help you with woo functionality creation. I have more 200 good reviews in dev projects, so all will be done on highest level. Price can be discussed. Please, do not award project Más

$45 USD en 1 día
(381 comentarios)
7.7
yogeshssanwal

Hi there - My name is Dimple. I’ve read your brief and can see that you’d like to build an Website. My team has 4 years experience designing and developing mobile apps and Websites as well as SEO.I would approach your Más

$88 USD en 3 días
(69 comentarios)
5.3
nileshbakotiya

you will find my services highly reliable and professional. My Vision : High Quality, High Speed, High Satisfaction! i have 7 years business experience with certified and skilled . We are always looking to push fo Más

$20 USD en 1 día
(11 comentarios)
2.9
salesankit90

Hello, I have been doing website designing and developing from last 5+ years and such jobs are my daily practice. This is my first time on this site and hence you can see that I don't have any ratings/testimonials t Más

$111 USD en 3 días
(1 comentario)
1.4
hanifkhan09

Dear client I am highly interested to do this project. I will make you happy.I don’t need any upfront or milestone payment. Pay me when you will happy. Looking forward. Thanks

$25 USD en 1 día
(0 comentarios)
0.0
amberoo6

I am 7 years expert in the relevent field.I understand your requirements so I offer you my services with quality work and will fully satisfy you. feel free to contact Thank you

$17 USD en 4 días
(0 comentarios)
0.0