I am using Woocommerce with Brevo for my transactional emails and even with the right settings my customer still receive WooCommerce basic email instead of the template I’ve made with Brevo.
I contacted the support of both my host provider (Infomaniak) and Brevo and they told me the problem is that Infomaniak blocs the PUT request. The request from Woocommerce needs to be POST request instead… and both told me they can’t do anything about it and I have to check with WooCommerce.
Has someone heard about this issue before ? What can I do to fix it ?
Thank you !
]]>I’m sending the token as an authorization header (schema: bearer).
This is what I’m sending:
Headers:
{
“user-agent”: “PostmanRuntime/7.29.2”,
“wp_api”: “True”,
“version”: “wc/v3”,
“Authorization”: “Bearer “,
“content-type”: “application/json”,
“accept”: “application/json”,
“accept-encoding”: “gzip, deflate”,
“content-length”: 1788
}
Body:
{
"name": "HB123456",
"type": "simple",
"description": " ",
"short_description": "",
"status": "draft",
"regular_price": "10.00",
"acf": {
"item_status": "On Hold"
}
}
Can you provide an example of a POST/PUT request that shows the structure of the payload to update ACF fields?
]]>As well as text input fields, the form also allows sending of some attached files with the request, which is all sent to the server as a POST request.
For a small percentage of users, when attaching a PDF file, the submission of the form is being blocked by the WordFence WAF, which states:
“A potentially unsafe operation has been detected in your request to this site”
However, no entries appear in the ‘Live Traffic’ view when this happens to indicate why the request was blocked. (I’ve tried ‘All Traffic’ and ‘Security Only’ modes)
I’ve also tried putting the firewall into learning mode, and replicating a submission that would be blocked, but this doesn’t seem to help. After turning the firewall back to enabled, the request is blocked again.
Does anyone have any pointers as to what other steps I might try, to stop these requests from being blocked?
]]>Thanks!
]]>
my-plugin
|-admin
| |-settings-page.php
|
|-my-plugin.php
I have a <form>
that I am trying to process using admin-post.php
, but I can’t figure out how to get a response out of this thing to make sure it is working but can’t find any relevant information that answers my question.
my-plugin.php
is:
if (!defined("ABSPATH")) {
exit;
}
if (is_admin()) {
require_once plugin_dir_path(__FILE__) . "admin/settings-page.php";
}
add_action("admin_post_process_form", "process_form");
function process_form()
{
wp_redirect("https://localhost:10054/");
exit;
}
It lands on https://localhost:10054/wp-admin/admin-post.php
but doesn’t redirect. I don’t care about processing information yet, I just want to know that it is recognizing my function. Every tutorial tells me to put this in functions.php
, which kinda defeats the purpose of the plugin.
AFTER the payment, the e-mails are being sent.
I would like to hook up here, and as the emails to customer and admin are sent
i need to shoot a POST request to my CRM.
Should not be a huge problem, all the data are collected for the email in Webhook.php.
Any ideas please?
I’ve been trying to find a piece of AJAX code that works, or how to layout my own that successfully sends and recieves a AJAX post request from my own custom plugin.
I started by using the code from here but I think it had something to do with the url missing. I added in ‘admin_url(‘admin-ajax.php’)’
Sorry for the code dump, but I have no idea what an where I am going wrong.
close_pressed and open_pressed are the php functions.
openShop() and closeShop() are JS functions.
add_action("wp_ajax_open_pressed","open_pressed");
add_action("wp_ajax_close_pressed","close_pressed");
add_action("wp_ajax_nopriv_open_pressed","open_pressed");
add_action("wp_ajax_nopriv_close_pressed","close_pressed");
function exampleMenu()
{
echo <<< 'EOD'
//
//backend settings display
//
<h2> Is your Shop open?</h2>
<p id="Status">The shop is Open</p>
<button onclick='openShop()'>Indicate Open</button>
<button onclick="closeShop()">Indicate Closed</button>
//
//
//
//Below is the issue
//
<script>
function openShop(){
document.getElementById("Status").innerHTML = "The shop is Open";
jQuery(document).ready(function() {
var data = {
'action': 'open_pressed',
'post_type': 'POST',
'name': 'Close the shop'
};
jQuery.post("admin_url( 'admin-ajax.php' )" , data, function(response) {
console.log( response );
}, 'json');
});
}
function closeShop(){
document.getElementById("Status").innerHTML = "The shop is Closed";
jQuery(document).ready(function() {
jQuery(document).ready(function() {
var data = {
'action': 'close_pressed',
'post_type': 'POST',
'name': 'Close the shop'
};
jQuery.post("admin_url( 'admin-ajax.php' )" , data, function(response) {
console.log( response );
}, 'json');
});
}
</script>
EOD;
}
function open_pressed(){
$isOpen = true;
setIsOpen($isOpen);
$name = isset($_POST['name'])?trim($_POST['name']):"";
$response = array();
$response['message'] = "Successfull Request";
echo json_encode($response);
exit;
}
function close_pressed(){
$isOpen = false;
setIsOpen($isOpen);
$name = isset($_POST['name'])?trim($_POST['name']):"";
$response = array();
$response['message'] = "Successfull Request";
echo json_encode($response);
exit;
}
}
Note: The Changing of the <p id=’status’> occurs, The javascript does run.
When I check the chrome logs, no Successful request shows up nor does the $isOpen change, so I thus assume the problem lies within the jQuery.