Completed

Code snippet -- 2

Hello, we have a website running Wordpress 5.7, WooCommerce and the plugin "Advanced Product Fields Extended for WooCommerce". With this plugin we created a configurable product. We need a snipped code who will be triggered when the customer add the product to the cart, then the snipped should evaluate the options selected and create dynamically a SKU. This is how the snippet should work:

1) We need to define a table where, for each ID field, we can specify the position in the generated SKU, the action to perform and the values. For instance:

60488199a092b;1;2;(polyester,PN),(light,PL)

60488199a092c;2;2;(single,01),(double,02),(blockout,03)

60488199a092d;3;1;3

60488199a092e;4;1;3

60488199a092f;5;2;(loop,CA),(eyelet,EY)

60488199a092g;8;2;(double,ST),(single;SI),(cut,CU)

60488199a092h;11;2;(double,ST),(single;SI),(cut,CU)

60488199a092i;14;2;(double,ST),(single;SI),(cut,CU)

Where the first number is the ID field, the second number the position in the final SKU, the third is the action and the fourth the values to pass to the action

-Action 1

Take the value assigned to the field (for instance, “6”) and transform it in the number of digits specified in the variable (for instance “3”) adding “0” or “00” . The result of the example should be 006.

-Action 2

Take the value (for instance, “red”) assigned to the field and find the correct value to replace (for instance, the values passed to this action are "(red,01),(blue,02)(yellow,03)". In this case, the result of “red” should be “01”.

2) A variable for the separator symbol, for instance:

“-“

Where - will be the symbol who the snippet will use to separate each part in the final SKU

3) A variable for the missing value, for instance:

“XX”

Where XX will be the value for missing parts of the final SKU

4) A variable with the number of parts of the final SKU, for instance “16”

So, if the customer configured those values:

60488199a092b value is “polyester”

60488199a092c value is “single”

60488199a092d value is “10”

60488199a092e value is “15”

60488199a092f value is “loop”

60488199a092g value is “double”

60488199a092h value is “double”

60488199a092i value is “double”

The transformation for each position is:

The value for position 1 is “PN”

The value for position 2 is “01”

The value for position 3 is “010”

The value for position 4 is “015”

The value for position 5 is “CA”

The value for position 8 is “ST”

The value for position 11 is “ST”

The value for position 14 is “ST”

Since the final SKU should be made by 16 different parts (specified in the variable 4), the missing parts are:

The value for position 6 is “XX”

The value for position 7 is “XX”

The value for position 9 is “XX”

The value for position 10 is “XX”

The value for position 12 is “XX”

The value for position 13 is “XX”

The value for position 15 is “XX”

The value for position 16 is “XX”

Then, the final SKU should be:

PN-01-010-015-CA-XX-XX-ST-XX-XX-ST-XX-XX-ST-XX-XX

Skills: PHP, JavaScript, WordPress, WooCommerce

See more: wordpress advanced custom fields template, building website wordpress advanced, wordpress code snippet, wordpress advanced custom fields form, code snippet wordpress, code for develop a website for marketing a product, wordpress, Advanced Custom Fields, wordpress code snippet plugin, wordpress code snippet in post, wordpress advanced custom fields display, insert php code snippet wordpress, how to create 2 website in wordpress, wordpress insert code snippet, how to code a website in wordpress, code snippet website, wordpress advanced custom fields page template, wordpress advanced custom fields documentation, advanced product fields for woocommerce, wordpress advanced custom fields add more

About the Employer:
( 5 reviews ) Ljubljana, Italy

Project ID: #29855565

Awarded to:

mchsolutions

Hi, I'm a Wordpress developer with experience in plugins development. I can do this snippet in 2 days.

$150 USD in 2 days
(16 Reviews)
5.0

18 freelancers are bidding on average $154 for this job

WordpressHeroes

Hey! How we can finish your project in time and perfect? The communication is very important! Send me a message now, and we can discuss everything! I have read the project requirements carefully and I am very much in More

$200 USD in 2 days
(225 Reviews)
7.7
smartwinz

Hello Hiring Manager, Greetings from SMARTWINZ SOLUTIONS!!! I am expert in HTML , CSS , JAVASCRIPT , JQUERY , BOOTSTRAP , PHP , CODEIGNATOR , CAKEPHP, LARAVEL, WORDPRESS ,SHOPIFY , WIX , SQUARESPACE , MAGENTO 2 , JOO More

$110 USD in 5 days
(88 Reviews)
7.4
(44 Reviews)
6.8
vashishtrupinder

Hi I AM READY TO START NOW I read through the job details carefully and I am absolutely sure that we can do the project very well. In a nutshell, I'm a freelancer with more than 7 years of work experience. Expert More

$250 USD in 7 days
(108 Reviews)
6.6
(46 Reviews)
6.1
santoshm143

Salutations, I am a Senior developer having 7+ years of experience in 450+ websites and 200+ apps all finalized using PHP, WordPress, JavaScript, and others. Let's have a detailed discussion of the project. The follo More

$140 USD in 7 days
(62 Reviews)
6.6
masterminds7860

Hi there, I checked your "Code snippet" job details carefully and would like to start immediately. I have not attached my previous work link as other freelancers copied my work before. Ping me, I will share you my pre More

$250 USD in 5 days
(14 Reviews)
5.7
davronbekvssatto

Hey! I am an expert Full stack developer with skills including WordPress, PHP, WooCommerce and JavaScript etc. Very Thanks for positing "Code snippet -- 2" and i read I hope work with you because my skill set is very More

$155 USD in 7 days
(12 Reviews)
4.9
umer6316326

Hi , I got myself interested and very suitable for this project and would like to discuss it with you over the chat so proceed further as i am having experience and expertise in PHP, JavaScript, WordPress and WooComme More

$155 USD in 7 days
(15 Reviews)
5.2
sergadamd

Hi, I have read your post carefully. I can write a code snippet that will be triggered when adding a product to cart and then it will be used to generate dynamic SKU. I have 8 years of experience in wordpress and wooco More

$250 USD in 7 days
(13 Reviews)
4.4
(11 Reviews)
4.5
ivanselyutin2020

Thanks for having opportunity to post with your job. After checking your description, I understood that you want to generate sku dynamically using code. For trigger, we have to use action and hook that wordpress suppo More

$140 USD in 2 days
(10 Reviews)
4.2
vladilavsuhovoy1

Hi, How are you? I’ve carefully checked " Code snippet -- 2" and really interested in this job. I have rich experiences in WordPress, PHP, JavaScript and WooCommerce. I’m ready to discuss your project and start imme More

$150 USD in 5 days
(12 Reviews)
4.2
dddigitaldata

Hello, I have just studied the project description and I am confident that I will develop a snipped code who will be triggered when the customer will add the product to the cart, then the snipped will evaluate the opti More

$100 USD in 1 day
(17 Reviews)
4.8
predraghristov

Hello! Thank you for your job posting. I read your requirement carefully. And I feel that I am a best fit for your project.   As an honest and experienced developer, I have been always working to deliver clients perfec More

$140 USD in 7 days
(2 Reviews)
2.2
savvysoftsol

I go through your requirement of WordPress development and I am intrested in further discussion regarding project in chat. Wordpress Theme and Plugin Development Website Designing Development Maintenance Building new More

$50 USD in 4 days
(1 Review)
1.4
AscogentCreative

Hello Sir! Thank you so much for the nice project about Wordpress Website Development: Code snippet -- 2 I have developed more than 500 website which are in Wordpress CMS. After reading the project details i underst More

$90 USD in 3 days
(0 Reviews)
0.0