On my WordPress/WooCommerce website we offer free delivery for all orders over 500 DKK. This is working perfectly fine. We have made a giftcard as a virtual product, seeing as we sent all of our …
Tag: php
Hook woocommerce price in backend order edition
I need to change item product prices in Woocommerce Backend Order. I tried tu use the following hook, but I have a problem trying to obtain the order id. Any suggestion? Thanks in advance! Complete problem: The complete problem is as follows. I am using a plugin that adds a field to the product called wholesale price. If the customer
How to mock properly IlluminateHttpRequest class from Laravel
I’m trying to test a method from a class which contains a method using the request() helper from Laravel. This is the method: Category class The test should make this helper to catch properly the URI when doing getRequestUri() but it’s actually returning an empty string. This is one of the thousand tries that I gave to the test. Test
Enabling php ext-xml?
While trying to use Composer to create a Symfony 4 project I got the following error: I did search in php.ini for ext-xml to see if I could uncomment it in order to enable it but I did not find any mention of ext-xml. I have not searched anywhere else because I am very unsure about what I am doing.
Get all Product Variations based on one default attribute value in WooCommerce
Following Loic’s workflow here Can I get all the variations related to the product basing on one particular variation in default value. Example: Get all variations with attribute_pa_sizes similar to the default value’s attribute_pa_sizes echo $variation_values[‘attributes’][‘attribute_pa_sizes’] . ‘: ‘ . $price ; Answer This can be done with the following code (based on this answer): Tested and works
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘payments’ already exists (SQL: create table `payments`
When I migrate a table I see this error, SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘payments’ already exists (SQL: create table payments Error Answer If you want to recreate the table, run php migrate:rollback first to delete the existing one. This command will run the down() method in the migration. Then run php migrate to create the
Sufficient API Response for Mobile App
I’m creating an API for my mobile app with Laravel – Lumen and i have the following scenario which i don’t know what is the most sufficient way to return the response to my Android / IOS App, lets assume that the user is trying to sign in (same end point): Case 1 : the user provide the correct data
PHP Notice: Use of undefined constant php – assumed ‘php’
Was just editing a site I’m working on to include the subscription form in the footer.php rather than just the homepage. I made the changes on the local server then moved it to my live environment (…
Creating WooCommerce product variation adds an empty attribute value
When adding variations to a WooCommerce product it is adding in a blank attribute. Meaning that when I try to add in my own attribute it gets appended to an existing array. Example code I am running: Then when I var_dump($product_variation); I get the following: So when I view the product in WooCommerce admin all my variations are there but
set base URL dynamicaly in Laravel 5
I have two versions of a site one running at on example.com and other at example.com/version2. In web.php I have In webconfig middleware I set database connection for version2 site. Which is working fine but I am also setting base URL for version2 site. which not working url() method returns example.com Here is my webconfig middleware So how can I