Category "php"

Display the WooCommerce product price inside a custom function

I have created a custom function to display 3 custom fields (ACF) and the product price in the WooCommerce Archive/Shop page. My Custom fields are showing corre

Getting failed loading params from .env vlucas/phpdotenv library required, but library is in

When I try to run my PHP Codeception test environment through Docker in my project, I get the following error: docker-compose run --rm codecept run ui_aut

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

When making a php cURL request in production, I am getting the following error: Problem with SSL certificate: self-signed certificate in the certificate chain.

How to get an Array value inside an object in an array Php [duplicate]

I have this array below at the last code part. To get ["db"] and ["size"] object in array through a loop I use <?php foreach ($result->

Display a success custom notice after Placing an Order in WooCommerce

I need to check on the checkout page whether payment has been successful or not and display the message: 'Your payment has been successful', and then redirect t

Laravel 8 http testing error Failed asserting that two strings are equal

I want to test the endpoint Sign Up (you can consider signup as registration), and at the same time I want to return the response object and redirect the user t

Separate SQL commands in PHP

I have a (dynamically generated) file that includes a lot of SQL Statements that contain only data definition. Usually, I run the whole script as a single trans

get data-value with variable value

I have a data-value in my php code that is used in several places, for example: <a class="dropdown-item" data-value="<?= $i ?>"></a> <a cla

How to Create WooCommerce Subscription Product via. REST API?

I am able to find the REST API docs for WooCommerce: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product but am unable to figure out how t

Use environment variables in Laravel Nova

I am trying to follow: https://laravel.com/docs/9.x/mix#environment-variables My project setup is Laravel Framework 8.4 Php 7.4 Laravel Nova 3.0 .vue file in /n

Sagepay Error The Vendor failed to provide a RedirectionURL

Integrating the Sagepay payment in PHP. I am getting logs in notification URL and getting response data including transaction details. From there passing the re

How to render html from a @foreach loop in a textarea

Using Laravel 8 livewire, I need to render a list of name ($list) on per line in a textarea. I do this <div class=" border border-red-800 rounded-lg mt-8 p-4

How create Nginx redirect if php send 404 error

i have a project and this project installed on few servers, he has one code, example: Server "A" => Project "A" Server "B" => Project "A" Project has bun

How create Nginx redirect if php send 404 error

i have a project and this project installed on few servers, he has one code, example: Server "A" => Project "A" Server "B" => Project "A" Project has bun

Use array_filter in foreach

I am presenting this problem when making a store in my database, which is data entered from a table in my view. Example: table For example, my user selects row

Use array_filter in foreach

I am presenting this problem when making a store in my database, which is data entered from a table in my view. Example: table For example, my user selects row

getting null values from the collection

I have an array that comes from an API request that has the stucture below. ^ array:40 [ "id" => 2 ... "categories" => array:2 [ "data" => ar

NginX: catch all file outside of root dir, with exceptions

I'm building a site running NginX / PHP and want all access to be processed by /private/routes.php. But I also want to add some exceptions to this for css/js-fi

Product varient size validation on Add to card in laravel

I'm using Laravel and I'm struggling a little bit with Add to cart button validation. The scenario is: if user want to Add to cart to cart is not added without

How to load Codeigniter 4 lang file into an array variable

Is there a way to load a file from Codeignier 4 Language directory and assign the array content to a variable. Instead of returning the translated line, I want